![]() |
|
|
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 |
| forums to hire unix experts | itmgr | Shell Programming and Scripting | 3 | 05-08-2007 11:06 PM |
| Calling All Aix Experts | Courtney3216 | AIX | 0 | 03-17-2006 08:30 PM |
| Shell Coding question for any experts out there | dfran1972 | Shell Programming and Scripting | 4 | 01-12-2004 09:04 AM |
| Help from lint experts needed | amatsaka | High Level Programming | 2 | 03-29-2002 08:42 AM |
| Experts Only! Hard Question Ahead!!!! | Foo49272 | UNIX for Advanced & Expert Users | 1 | 01-07-2002 10:22 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Need help - from awk, sed experts
Hi ,
I have a file as below. Contents of the file are -------------------- aaaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaa bbbbbbbbbbb ccccccccccc ddddddddddd aaaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaa bbbbbbbbbbb ccccccccccc ddddddddddd aaaaaaaaaaa I want to do the follwing if exists "ccccccccccc" get "bbbbbbbbbbb" "ccccccccccc" "ddddddddddd" fi Can someone help me in doing this using awk/sed.. thanks srini |
|
||||
|
Hi Perderabo,
It works fine . But can you please explain me what exactly happening here , sed -n -e ":l" -e "h;n;s/$1/$1/;t m" -e "b l" -e ":m" -e "H;n;H;g;p" and what if, if I want to get 3 lines before the search string and one line after the search string . i.e aaaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaa kkkkkkkkkkk llllllllllllllllllllllllll tttttttttttttt bbbbbbbbbbb ccccccccccc ddddddddddd aaaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaa kkkkkkkkkkk llllllllllllllllllllllllll tttttttttttttt bbbbbbbbbbb ccccccccccc ddddddddddd aaaaaaaaaaa aaaaaaaaaaa kkkkkkkkkkk llllllllllllllllllllllllll tttttttttttttt bbbbbbbbbbb ccccccccccc ddddddddddd aaaaaaaaaaa Thanks srini |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|