![]() |
|
|
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. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
help with sed
i have two files file 1 containing : Code:
aaa bbb ccc . . . zzz file 2 containing Code:
111 222 333 111 222 333 . . . what i want in the end is this in file 3 Code:
111 222 aaa 111 222 bbb 333 111 222 ccc . . . i know i can do this with sed and i have done it for one string to be inserted after a particular pattern but i am able to do the action above may be its possible with a loop but i have been trying for some time cant arrive please help Last edited by vgersh99; 08-21-2009 at 09:06 AM.. Reason: code tags, PLEASE! |
|
|||||
|
Not sure I get your criteria totally, from your expected output: Code:
111 line 1 from file2 222 line 2 from file 2 aaa line 1 from file 1 111 line 4 from file2 ... what happened to line 3 from file 2 222 line 5 from file2 bbb line 2 from file 1 333 line 6? from file2 111 line 7 from file2 222 line 8 from file 2 ccc line 3 from file 1 Do you just want to get two lines from file2, followed by one line from file 1 ? Code:
cat file2 | paste - - file1| tr "\t" "\n" Or is there more complex criteria ? HTH |
|
||||
|
actually Tyatalus
i have file 1 containing different strings each in a differnt line and what i want to do is insert these strings before a particular pattern in file 2 eg file 1 may contain AAA BBB and so on there are 201 entries exactly now i want to insert AAA after pattern XXX in file 2 then BBB after the next occurence of pattern XXX and so on |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|