Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do take out some lines !! 1

Status
Not open for further replies.

rao12

IS-IT--Management
Jan 10, 2001
9
0
0
US
i have a file with contents like

<<< file1: abcd.c
>>> file2: abcd.cx
--------[after 12]-----|-----------[inserted 67-80]------
---------[deleted 67-89]---|---------[after 56]----------
<<< file1: def.c

how do i select only lines that come in between >>> and
<<<

ie.,

--------[after 12]-----|-----------[inserted 67-80]------
---------[deleted 67-89]---|---------[after 56]----------

and from this i would like to take out the

12 67-80
67-89 56

If anyone can help me it would be very good.

Thanks
Rao
 
I have not run this, but it should be pretty close. Inside the inner most 'while', do what ever you like with the numbers.

open(IPF,&quot;<inputFile&quot;) or die &quot;Failed to open inputFile, $!\n&quot;;
while (<IPF>) { $buffer .= $_; }
close IPF;

# while matching stuff between >>> and <<<
while ($buffer =~ />>>(.*?)<<</gs)
{
# catch matched strings in $chunk
$chunk = $1;
{
while ($chunk =~ /\[\w+ (.*?)\]/gs) { $numbers = $1; }
}
}

'hope this helps


keep the rudder amid ship and beware the odd typo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top