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 > inserting data into a file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-06-03, 12:09
Douglas Anderso Douglas Anderso is offline
Registered User
 
Join Date: Jul 2003
Posts: 6
inserting data into a file

Okay now I need to insert text into a data file.

For example, I'd like to put a certain data the start of line 1, different commands at the start of line 2, and insert a data on line 10, column 20...It can't overwrite the current info but it must insert...

Thoughts...Can I use VI from the command line or is there another easy way...I've tried awk and that works for some of it but not all aspects...


Any help would be appreciated.

Doug.
Reply With Quote
  #2 (permalink)  
Old 10-06-03, 12:56
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
Re: inserting data into a file

Not sure I understand you correctly but this might help...

awk 'NR==1{print "yourData1" $0}NR==2{print "yourData2" $0}NR==10{print substr($0,1,20) "yourData3" substr($0,21)}'
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