Re: matching certain lines

2013-02-10 Thread Chris Stinemetz
On Sun, Feb 10, 2013 at 8:05 AM, Chris Stinemetz wrote: > To take this a step further. > > How would you go about creating a hash to sum up all the values in group > $3 utilizing the flip/flop operator and print the results of the key and > value with the key being group $2? > > This is what I cam

Re: matching certain lines

2013-02-10 Thread Chris Stinemetz
To take this a step further. How would you go about creating a hash to sum up all the values in group $3 utilizing the flip/flop operator and print the results of the key and value with the key being group $2? Thank you, Chris while( ) { if ( /0x3\|68\|/ .. /^#END/ ) { print if /\|

Re: matching certain lines

2013-02-10 Thread Chris Stinemetz
Thank you everyone for you help. -Chris On Sat, Feb 9, 2013 at 5:15 PM, Uri Guttman wrote: > On 02/09/2013 03:59 PM, John W. Krahn wrote: > > >> Let's re-factor that down to its essence: >> >> while ( ) { >> print if /\|68\|/; >> print "$1\t$2\t$3\n" if /(\|\d)\|(\d+)\|(\d+)/; >>

Re: matching certain lines

2013-02-09 Thread Uri Guttman
On 02/09/2013 03:59 PM, John W. Krahn wrote: Let's re-factor that down to its essence: while ( ) { print if /\|68\|/; print "$1\t$2\t$3\n" if /(\|\d)\|(\d+)\|(\d+)/; } Now we need to add something that starts at |68| and stops at #END: while ( ) { if ( /\|68\|/ .. /^#EN

Re: matching certain lines

2013-02-09 Thread timothy adigun
Hi, On Sat, Feb 9, 2013 at 6:06 PM, Chris Stinemetz wrote: > I would like to only work with the data that has a line with |68| in it > Does it mean even, that |68| can be anyway in the your data before any of the #END is reached? If yes, then I think you have been given a good solution. If not,

Re: matching certain lines

2013-02-09 Thread John W. Krahn
Chris Stinemetz wrote: I would like to only work with the data that has a line with |68| in it print that line and then print each subsequent lines in that match /\|7\|\d+\|\d+/ until #END is reached and then repeat for the rest of the input data. Below is what I have attempted. Thanks in adva

Re: matching certain lines

2013-02-09 Thread David Precious
On Sat, 9 Feb 2013 11:06:46 -0600 Chris Stinemetz wrote: > I would like to only work with the data that has a line with |68| in > it print that line and then print each subsequent lines in that match > /\|7\|\d+\|\d+/ until #END is reached and then repeat for the rest of > the input data. OTTOMH

matching certain lines

2013-02-09 Thread Chris Stinemetz
I would like to only work with the data that has a line with |68| in it print that line and then print each subsequent lines in that match /\|7\|\d+\|\d+/ until #END is reached and then repeat for the rest of the input data. Below is what I have attempted. Thanks in advance. Chris #!/usr/bin/p