Computing.Net > Forums > Unix > appending few lines to a file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

appending few lines to a file

Reply to Message Icon

Name: trichyselva
Date: August 10, 2006 at 08:06:57 Pacific
OS: xp
CPU/Ram: p4
Product: pentium
Comment:

i want to open a file automatically (not by using vi) (ex. from another file) insert few characters at say 12th position to 15th position and save it



Sponsored Link
Ads by Google

Response Number 1
Name: lchi2000g
Date: August 10, 2006 at 20:05:24 Pacific
Reply:

====> input file

$ cat file.txt
12345678901234567890
ABCDEFGHIJKLMNOPQRSTUVW

====> run it

/home/oracle/luke/tmp$ sed -e 's/^.........../&(ab)/g' file.txt

====> output

12345678901(ab)234567890
ABCDEFGHIJK(ab)LMNOPQRSTUVW

Luke Chi


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: appending few lines to a file

how to replace a line in a file www.computing.net/answers/unix/how-to-replace-a-line-in-a-file/7214.html

Script to Remove lines from a file www.computing.net/answers/unix/script-to-remove-lines-from-a-file/5268.html

Insert a line to many files www.computing.net/answers/unix/insert-a-line-to-many-files-/7125.html