If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > help in script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-23-03, 06:43
sant sant is offline
Registered User
 
Join Date: Sep 2003
Posts: 19
Question help in script

Hello
I need help for the accomplishment of a script. Of the result of the list of files in a directory unix, that they are different every day I have to refill different fields in another pattern file and redirecct to a final file
In other words

ls -1

pepe.g123
john.g456
tom.g789

hello I,m field1 hello I,m pepe
hello I,m field2 hello I,m g123
hello I,m field3 -----------> hello I,m john
bye field4 bye g456
bye field5 bye tom
bye field6 bye g789



I am doing it with a loop(for) of the name of file and later with the commands (sed) and (cut) but I find solve limitations that I am not to solve. I don’t know well the command (awk), I’m sure will help me yo solve the problem.

Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 10-23-03, 06:49
sant sant is offline
Registered User
 
Join Date: Sep 2003
Posts: 19
Sorry
In my previous mail the example was not written well I think that this understands better

ls -1

pepe.g123
john.g456
tom.g789

pattern file......................... final file

hello I,m field1..................> hello I,m pepe
hello I,m field2..................> hello I,m g123
hello I,m field3..................> hello I,m john
bye field4..........................> bye g456
bye field5..........................> bye tom
bye field6..........................> bye g789
Reply With Quote
  #3 (permalink)  
Old 10-28-03, 23:52
karthi_tvr karthi_tvr is offline
Registered User
 
Join Date: Oct 2003
Location: Singapore
Posts: 12
Smile

In the crudest form, you can get the fields value by using :-

ls | while read line
do
echo $line | awk -F"." '{print $1}'
echo $line | awk -F"." '{print $2}'
done

Hope this helps.
__________________
Thanks and Regards
Karthik R
Reply With Quote
  #4 (permalink)  
Old 10-29-03, 04:41
sant sant is offline
Registered User
 
Join Date: Sep 2003
Posts: 19
Smile

This works well, now I must find the way to change to the fields
obtained within the file pattern. I hope to obtain it.

Thank you very much by your aid
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On