![]() |
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 |
| Grep and delete lines except the lines with strings | vj8436 | Shell Programming and Scripting | 14 | 04-17-2009 11:25 AM |
| How to delete first 5 lines and last five lines in all text files | ragavendran31 | Shell Programming and Scripting | 10 | 02-21-2008 07:58 AM |
| How to delete more lines | kamathg | Shell Programming and Scripting | 1 | 10-05-2007 06:39 AM |
| delete blank lines or lines with spaces only | vascobrito | UNIX for Dummies Questions & Answers | 3 | 01-13-2004 07:36 AM |
| delete lines.. | alisevA3 | UNIX Desktop for Dummies Questions & Answers | 8 | 05-29-2002 08:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to delete matter in between two lines
help
I am having text file like this... ------------------------END OF UPDATION ------------------ xxxxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyy 1 row updated ------------------------END OF UPDATION ------------------ TTTTTTTTTTTTTTTT FFFFFFFFFFFFFFFFF 0 rows updated ------------------------END OF UPDATION ------------------ UUUUUUUUUUUUUUUUUU SSSSSSSSSSSSSSSSSSS 1 row updated ------------------------END OF UPDATION ------------------ i want to delete the matter in which text is having 0 rows updated in between two lines...and even lines also.... i.e ------------------------END OF UPDATION ------------------ TTTTTTTTTTTTTTTT FFFFFFFFFFFFFFFFF 0 rows updated ------------------------END OF UPDATION ------------------ advance happy new year |
|
||||
|
#! /usr/bin/perl
undef $/; open FH,"<a.txt"; $str=<FH>; @arr=split("------------------------END OF UPDATION ------------------",$str); print "------------------------END OF UPDATION ------------------\n"; for($i=1;$i<=$#arr;$i++){ @tmp=split("\n",$arr[$i]); print $arr[$i] if (!($tmp[$#tmp]=~/0 row/)); } print "------------------------END OF UPDATION ------------------\n"; close FH; |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|