Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003

    Unanswered: 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.


  2. #2
    Join Date
    Jun 2002

    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)}'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts