cryptic one liner explain
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 Inuse Pin Pgsp Virtual 64-bit Mthrd 16MB 1450182 oracle 256730165584 1345587 3132033 Y N N 1179888 oracle 211748065584 1343450 2680222 Y N N 1446084 oracle 211548165840 1346761 2681480 Y N N -- The ouput it is parsing looks like this: --- Pid Command Inuse Pin Pgsp Virtual 64-bit Mthrd 16MB 1450182 oracle 250122265586 1345953 3066501 Y N N PageSize InusePin PgspVirtual 238845 - clnt /dev/fslv00:41875s 0 0- - ... --- Pid Command Inuse Pin Pgsp Virtual 64-bit Mthrd 16MB 1794286 oracle 213139765604 1343816 2695867 Y N N PageSize InusePin PgspVirtual s 4 KB2063541 2013438162628011 . and so on -- i understand that it resets the line count every time it sees a line of "" and it then will print line 2 which is the summary line we are looking for. not sure what this part does "($.==2 || $& && !$x+ +)" thanks -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: cryptic one liner explain
> > 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 and the program goes on to the next statement. If $& is > true then $x is negated and tested and incremented (in that order) and > if $x is true then the program goes on to the next statement else if $x > is false then the current line is printed. > > John > -- Thanks John and Erez for the expanation. I understand it now -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: split function
split() splits on whitespace by default. so the "\s+/" is optional. $_ = "3 element array"; @words = split; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: ipc question
On Dec 14, 6:42 pm, oiss...@gmail.com (Tessio Fechine) wrote: > Hello, > I have a cgi application that has a two way communication with a ldap > application via open2: > > |home.cgi| <===> |ldap.pl| > > I need to keep communicating with the same ldap.pl process as other cgi > scripts are launched: > > |home.cgi| xxx |ldap.pl| <===> |admin.cgi| > > I don't know how to do that. > Maybe if it were possible to open a pipe to a running application using > it's pid.. you might want to state more information or show the code your having trouble with -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: awk to Perl
> I'm tyring to covert an AWK script to Perl. Is there a better alternative > > then a2p? write down logically what you want to achieve with the awk script ( pseudocode ) then write it in perl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/