![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| insert one file into middle of another file | cdfd123 | Shell Programming and Scripting | 4 | 03-07-2008 08:13 AM |
| capturing line from script output and appending to a file | wally_welder | Shell Programming and Scripting | 6 | 08-31-2007 03:03 AM |
| How to insert the 1st arg into the middle of the file | boris | Shell Programming and Scripting | 4 | 04-13-2007 12:21 AM |
| How to insert text into first line of the file and middle of the file? | ali hussain | Shell Programming and Scripting | 3 | 03-05-2007 05:54 AM |
| Reading specific contents from a file and appending it to another file | dnicky | Shell Programming and Scripting | 5 | 10-04-2005 05:45 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
hi,
i have a file file1 file2 ----------- ----------------- aa bbb ccc 111 1111 1111 ddd eee fff 222 3333 4444 ggg hhh iiii 555 6666 777 i select the portion of file1 as sed -n '/aa/,/fff/p' file1 ,, this select first two lines of file1, now i need to append these lines to the middle of file2 ie between line1 and line2 Please help me |
|
||||
|
Quote:
Code:
sed "1c\\
$(sed -n -e "/aa/,/fff/{/fff/ ! s/$/\\\\/;p; }" file1)
" file2
|
| Sponsored Links | ||
|
|