![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| appending to sed output of one file into the middle of file | go4desperado | Shell Programming and Scripting | 5 | 02-04-2007 11:20 PM |
| Reading specific contents from a file and appending it to another file | dnicky | Shell Programming and Scripting | 5 | 10-04-2005 02:45 AM |
| appending to a file in sftp | borncrazy | Shell Programming and Scripting | 3 | 09-01-2004 10:23 AM |
| appending a file | chumba | UNIX for Dummies Questions & Answers | 1 | 05-24-2001 08:09 AM |
| Appending out to a file | Astudent | UNIX for Dummies Questions & Answers | 1 | 10-19-2000 11:17 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
i am trying to append a 5 line SGML file(file1) with a 500,000 line SGML file (file2).
file1 is a template, so i wish to preserve. i only want to add lines 5 to the end of file2. i have: cp file1 temp1 sed -n '5,$p' file2 >> temp1 when i check the tail of temp1, i consistantly find the last 4 lines missing. i have run a line count on file2 and inserted in sed -n '5,500000p' with same result. please note, filepaths are absolute because the script runs from a seperate script folder. can someone help? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
It's not clear if you want to prepend or append, but one of these should do it:
cat extra file1 > file2 cat file1 extra > file2 extra is file with the 5 new lines. |
|
#3
|
|||
|
|||
|
thanks for replying Perderabo, but i was probably not clear.
file one actually has 7 lines. i want to replace the first 4 lines of file2 with file1. so i copied file1 to temp1 (new file), then tried to append the new file with lines 5 thru 548203 of file2. everything works except that i am always missing lines 548200 to 5482003 in the new file. i do not know how to extract lines 5 thru 548203 using cat. also, because the line count is a variable i'd prefer to not use head | tail. |
|
#4
|
|||
|
|||
|
nevermind...figured it out. thanks!
|
|||
| Google The UNIX and Linux Forums |