Re: cryptic one liner explain

2009-01-31 Thread thebarn...@gmail.com
> > perl -ne'print if $.==2 || $& && !$x++; $.=0 if /^--+$/' > > The $.==2 tests if the current line number is 2.  If $. is 2 then the > current line is printed and the program goes on to the next statement. > If $. is not 2 then $& is tested and if $& is false then the current > line is printed an

Re: cryptic one liner explain

2009-01-30 Thread John W. Krahn
thebarn...@gmail.com wrote: Hi Hello, I run this command and pipe the output to a perl one liner. not quite sure how it parses the data: svmon -Pt3 | perl -e 'while(<>){print if($.==2 || $& && !$x++); $.=0 if (/^--+$/)}' That can be shortened to: svmon -Pt3 | perl -ne'print if $.==2 || $&

Re: cryptic one liner explain

2009-01-30 Thread Erez Schatz
On 1/30/2009 12:59 AM, thebarn...@gmail.com wrote: Hi I run this command and pipe the output to a perl one liner. not quite sure how it parses the data: svmon -Pt3 | perl -e 'while(<>){print if($.==2 || $& && !$x++); $.=0 if (/^--+$/)}' i understand that it resets the line count every time it

cryptic one liner explain

2009-01-30 Thread thebarn...@gmail.com
Hi I run this command and pipe the output to a perl one liner. not quite sure how it parses the data: svmon -Pt3 | perl -e 'while(<>){print if($.==2 || $& && !$x++); $.=0 if (/^--+$/)}' which outputs: --- Pid Command