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 > Editing a file thro script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-27-04, 08:40
rkrishnan73 rkrishnan73 is offline
Registered User
 
Join Date: Mar 2004
Posts: 10
Question Editing a file thro script

Whats the best method to manipulate a text file through a script? A process would want to manipulate each single line of a file (identified by a unique value in the line) and change parts/entire content of the line.

I've tried using vi with "heredoc" but thats very tiring. Any better way?

Thanks to your suggestions.

Rgds, Ram.
Reply With Quote
  #2 (permalink)  
Old 05-27-04, 09:05
iaguigon iaguigon is offline
Registered User
 
Join Date: May 2004
Location: Barcelona, Spain
Posts: 54
Quote:
Originally Posted by rkrishnan73
Whats the best method to manipulate a text file through a script? A process would want to manipulate each single line of a file (identified by a unique value in the line) and change parts/entire content of the line.

I've tried using vi with "heredoc" but thats very tiring. Any better way?

Thanks to your suggestions.

Rgds, Ram.
Use awk. You can filter or change every line of the input file (which should be delimited). See then man page for details

Regards,

Iņaki
Reply With Quote
  #3 (permalink)  
Old 05-27-04, 09:20
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
man ex with the here-doc
Reply With Quote
  #4 (permalink)  
Old 05-27-04, 10:03
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
man ex with the here-doc
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