Register
It is currently Fri Apr 18, 2014 4:38 am

Should be REAL simple...


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 PostPosted: Fri Jan 25, 2013 10:30 am   

Joined: Fri Jan 25, 2013 10:20 am
Posts: 2
..and my brain can't wrap around it.

I have a file with a list of 'names' (txt-a)
I want it to be ouputted to another file with the names inserted into other text.(txt-b)

Example txt-a
Code:
Allan
Bobby
Charles
...
And so on...
Example txt-b
Code:
Hello Allan go to the left
Hello Bobby go to the left
Hello Charles go to the left
...

And so on...

Note the only thing changing is the name variable

I don't need the txt-b to be separate files outputted, I need all the names from txt-a to all be in txt-b, like the example

NOTE: txt-a has 1723 names... Script is the only way....

Help?


Top
 Profile  
 PostPosted: Fri Jan 25, 2013 12:14 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 512
Code:
grep -f file-a file-b


Top
 Profile  
 PostPosted: Fri Jan 25, 2013 1:40 pm   

Joined: Fri Jan 25, 2013 10:20 am
Posts: 2
Watael wrote:
Code:
grep -f file-a file-b


That has GOT TO BE one of the SILLIEST responses EVER

I need to INSERT the names from txt-a INTO predetermined text at a PREDETERMINED place, and append the entire resultant text to txt-b

Note the OP

txt-a has a LONG list of names, that need to be inserted into a line of text, then output that into a continuous file, that contains ALL the output.

Your response does Diddly-Squat.

Note I am asking for a script, NOT for a grep command that:
#1 Won't do what I'm asking
#2 Outputs NOTHING
#3 Has NOTHING to do with the OP


Top
 Profile  
 PostPosted: Fri Jan 25, 2013 2:05 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 512
You're so kind, and were so clear about what you want.

I won't even give you a hint.

plonk


Top
 Profile  
 PostPosted: Sat Jan 26, 2013 6:38 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 224
Location: London - UK
Code:
for name in $(<txt-a); do echo "Hello $name goto the left"; done > txt-b


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP