![]() |
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 |
| how to delete a first blank line from the file | aoussenko | Shell Programming and Scripting | 4 | 06-20-2008 12:05 PM |
| delete blank space in begining of line | karthikn7974 | Shell Programming and Scripting | 4 | 05-07-2008 04:40 AM |
| how to delete text from line starting pattern1 up to line before pattern2? | repudi8or | Shell Programming and Scripting | 5 | 04-15-2008 09:25 PM |
| how to delete line with matching text and line immediately after | orahi001 | UNIX for Dummies Questions & Answers | 6 | 01-15-2008 12:34 AM |
| regex to delete multiple blank lines in a file? | fedora | Shell Programming and Scripting | 6 | 10-11-2007 04:36 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
sed: delete regex line and next line if blank
Hi,
I want to write a sed script which from Code:
batiato: batiato/giubbe: pip_b.2.txt pip_b.3.txt pip_b.3mmm.txt bennato: bennato/peterpan: 123.txt consoli: pip_a.12.txt daniele: daniele/anna: abc.txt Code:
batiato/giubbe: pip_b.2.txt pip_b.3.txt pip_b.3mmm.txt bennato/peterpan: 123.txt consoli: pip_a.12.txt daniele/anna: abc.txt "if a line containing ":" is followed by an empty line delete both lines (the line with ":" and the empty line)" i.e. something like in general if a line containing regex1 is followed (immediately after) by a line containing regex2 delete both lines. if it would be on one line I would do: sed '/regex1.*regex2/d' --> how to spread this command on 2 lines? And consider hat in my case regex2 is an empty line ( i.e. ^$). thanks |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|