Register
It is currently Thu Apr 24, 2014 10:18 pm

Multiple files


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Tue May 19, 2009 9:51 am   

Joined: Tue May 19, 2009 9:40 am
Posts: 1
Good afternoon to you all

I need your help

I have the following script running. As you can see it´s purpose is to get the a, b and c parameters from file.txt and input them into the command:

########################################

cat /file.txt |
while read a b c; do

/usr/bin/rrdtool update "$a" --template "$b" $(date "+%s"):$($c)

########################################


But now I need to get the 3 parameters from different files. For instance, parameter A from fileA.txt, parameter B from fileB.txt and parameter C from fileC.txt...now since this is a cycle, I need them to respect their order from the file:

the parameter A from the 1st line from fileA.txt will correspond with parameter B from the 1st line from fileB.txt and the parameter C from the 1st line from fileC.txt.....

the parameter A from the 2nd line from fileA.txt will correspond with parameter B from the 2nd line from fileB.txt and the parameter C from the 2nd line from fileC.txt.....

and so on...

It must be done in bash scripting.

Does anybody know how to do this?

Any help is apreciated

Best regards and thank u all


Top
 Profile  
 PostPosted: Wed Jul 22, 2009 12:56 pm   
Moderator
User avatar

Joined: Wed May 03, 2006 2:05 pm
Posts: 242
That's interesting! You might want to take the contents of each file and insert them into an array. You could also use something like awk to get the parameter from the proper line (record, in awk) of each file. Could you go into a little more detail for your example?


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 4 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:  
cron


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