RE : RE : RE : Regular expressions

I am issuing this command on an Aix box and running allright :-)

Forgive my curiosity.. are you running Solaris on a x86 box?=20

Steve Hemond
Programmeur Analyste / Analyst Programmer
Smurfit-Stone, Ressources Foresti=E8res
La Tuque, P.Q.
Tel.: (819) 676-8100 X2833
shemond@smurfit.com=20



 > -----Original Message-----
 > From: drieux [mailto:drieux@wetware.com]=20
 > Sent: Wednesday, December 17, 2003 1:14 PM
 > To: Perl Perl
 > Subject: Re: RE : RE : Regular expressions
 >=20
 >=20
 >=20
 > On Dec 17, 2003, at 8:47 AM, Hemond, Steve wrote:
 > [..]
 > >     open(PS, "ps -efA|");
 > >     while (<PS>) {
 > > 	($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) =3D split;
 > [..]
 >=20
 > forgive me if I presume that you are running on some
 > version of Linux? ( because by BSD boxes do not like the "A"=20
 > and my Solaris box would get what you are looking for ) hence
 >=20
 > meatbop: 53:] ps -efA | grep httpd.conf
 > drieux   11069 10988  0 10:08 pts/0    00:00:00 grep httpd.conf
 > meatbop: 54:]  ps -efAww | grep httpd.conf
 > root      1644     1  0 Nov10 ?        00:00:00=20
 > /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
 > hqadmin   1645  1644  0 Nov10 ?        00:00:00=20
 > /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
 > hqadmin   1646  1644  0 Nov10 ?        00:00:00=20
 > /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
 > hqadmin   1647  1644  0 Nov10 ?        00:00:00=20
 > /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
 > hqadmin   1648  1644  0 Nov10 ?        00:00:00=20
 > /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
 > hqadmin   1649  1644  0 Nov10 ?        00:00:00=20
 > /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
 > drieux   11071 11031  0 10:08 pts/1    00:00:00 grep httpd.conf
 > meatbop: 55:]
 >=20
 > it is possible that you are getting bitten by the classic=20
 > problem of the 'ps output' being truncated to the 'terminal=20
 > size' since you did not expressly assert that you wanted to 'go big'.
 >=20
 > Hence the problem is NOT with the RegEx, but with=20
 > limitations of what is actually being put into $cmd based=20
 > upon the input from the popen() command as invoked.
 >=20
 > HTH.
 >=20
 >=20
 > ciao
 > drieux
 >=20
 > ---
 >=20
 >=20
 > --=20
 > To unsubscribe, e-mail: beginners-unsubscribe@perl.org
 > For additional commands, e-mail: beginners-help@perl.org=20
<http://learn.perl.org/> <http://learn.perl.org/first-response>

0
SHEMOND
12/17/2003 6:16:37 PM
perl.beginners 29388 articles. 4 followers. Follow

2 Replies
1102 Views

Similar Articles

[PageSpeed] 42
Get it on Google Play
Get it on Apple App Store

On Dec 17, 2003, at 10:16 AM, Hemond, Steve wrote:

> I am issuing this command on an Aix box and running allright :-)

interesting,

let's do a quick piece of test code

	open(PS, "ps -efA|") or die "unable to open ps command\n:$!";
     while (<PS>) {
		($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split;
		print "$pid -> $cmd\n";
	}
	close(PS);

that will at least get us to what is going on with
the actual $cmd data itself.

> Forgive my curiosity..

Curiosity Killed The Cat you know...
"But the cat came back, the very next day,
thought he was a gonner but cat came back..."
	- old american folk song.

> are you running Solaris on a x86 box?

Solaris on Sparc and x86
FreeBsd, some variations on linux,
my desk top tho is OSX.
Haven't been on an AIX box in a while.
Loved Unicos. But real Men are not afraid
to toggle it into a PDP-8.... or an AN/Ukky-20
in battleship grey, or ...


ciao
drieux

---

0
drieux
12/17/2003 6:24:16 PM
On Dec 17, 2003, at 10:24 AM, drieux wrote:

>
> 	open(PS, "ps -efA|") or die "unable to open ps command\n:$!";
>     while (<PS>) {
> 		($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split;
> 		print "$pid -> $cmd\n";
> 	}
> 	close(PS);

Tell me not to make my coffee with last night's bong water!
if split is splitting on the default blank space,

	root     $1
	1644     $2
	1  		$3
	0 		$4
	Nov10 	$5
	?       $6
	00:00:00  $7
	/usr/sbin/httpd2-prefork  $8

	-f /etc/apache2/httpd.conf

what we want is the saner process of

	($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split(/\s+/,$_,8);

eg:

sed 's/^/### /' junk.plx
### #!/usr/bin/perl -w
### use strict;
###
### open(PS, "ps -efAww | grep http|");
### while(<PS>)
### {
### #   my ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split;
### #           print "$pid -> $cmd\n";
### my  ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split(/\s+/,$_,8);
###     print "Better $pid -> $cmd\n";
###     print "\t$uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd\n";
###
### }

My Apology!

ciao
drieux

---

0
drieux
12/17/2003 6:38:12 PM
Reply:

Similar Artilces:

RE : RE : RE : RE : Regular expressions
Here is a sample of what your piece of code returns on my Aix box. 44520 -> /prog/gena/8.1.1/bin/dispatch 44650 -> reproject 45176 -> aioserver 45432 -> aioserver 45724 -> -ksh 46002 -> /bin/bsh 46232 -> /usr/dt/bin/dtterm 46584 -> /usr/bin/ksh 46820 -> /usr/dt/bin/ttsession 47060 -> /bin/bsh 47304 -> /usr/dt/bin/dtlogin 47396 -> /usr/dt/bin/dtterm 47722 -> dtfile 47942 -> /usr/dt/bin/dtsession 48272 -> dtfile 48568 -> ora_cjq0_gist 48758 -> gxtrackd 49032 -> dtwm 49330 -> /usr/lib/lpd/pio/etc/piohpnpf 49592 -> b...

RE : RE : RE : RE : Regular expressions #2
No worries :-) It works now, thanks a lot :-) Best regards, Steve Hemond Programmeur Analyste / Analyst Programmer Smurfit-Stone, Ressources Foresti=E8res La Tuque, P.Q. Tel.: (819) 676-8100 X2833 shemond@smurfit.com=20 > -----Original Message----- > From: drieux [mailto:drieux@wetware.com]=20 > Sent: Wednesday, December 17, 2003 1:38 PM > To: Perl Perl > Subject: Re: RE : RE : RE : Regular expressions >=20 >=20 >=20 > On Dec 17, 2003, at 10:24 AM, drieux wrote: >=20 > > > > open(PS, "ps -efA|") or...

RE : RE : RE : Regular expressions #2
drieux is right about me being exploring Perl. In fact, that is a good = exercice to play with regular expressions and data types as I had to = build a hash of hashes to do the thing. However, I wouldn't let a script in that stat if I knew of a = better/quicker/shorter method. I will then have to improve my script soon. What would be the best way to put values returned by the ps command you = just mentionned in variables? Thanks again for your great help.=20 P.S : I look like the typical lazy guy who don`t even read and try by = himself. This is because I am at work, ...

RE: Spam:RE: Spam:Re: Using regular expressions
Erps... Just re-read where you said: > You imply above that you will read the file "a line at a time" however > using a for loop will read the whole file into a list in memory. You=20 > need to use a while loop to read a line at a time. .... And you're right... :) Regards, =20 Michael S. E. Kraus Software Developer Wild Technology Pty Ltd _______________________________ ABN 98 091 470 692 Level 4 Tiara, 306/9 Crystal Street, Waterloo NSW 2017, Australia Telephone 1300-13-9453 | Facsimile 1300-88-9453 http://www.wildtechnology.net =20 The in...

RE : RE : Regular expressions
I think I begin to understand... I begin by fetching the results of the ps -efA command and split it into = many variables ($uid, $pid, etc.) open(PS, "ps -efA|");=20 while (<PS>) {=20 ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) =3D split; =20 if ($cmd =3D~ /dispatch genie/) { $infos{$pid}{'uid'} =3D $uid; $infos{$pid}{'ppid'} =3D $ppid; $infos{$pid}{'c'} =3D $c; $infos{$pid}{'stime'} =3D $stime; $infos{$pid}{'tty'} =3D $tty; $infos{$pid}{'time'} =3D $time;...

Re: Re:
Sorry about that, my mistake, the patched method goes like this: procedure DeallocateHWnd(Wnd: HWND); var Instance: Pointer; begin Instance := Pointer(GetWindowLong(Wnd, GWL_WNDPROC)); if Instance <> @DefWindowProc then begin { make sure we restore the default windows procedure before freeing memory } SetWindowLong(Wnd, GWL_WNDPROC, Longint(@DefWindowProc)); FreeObjectInstance(Instance); end; DestroyWindow(Wnd); end; "Andreas Hausladen" <AndreasDOTHausladen@gObviousToBeRemovedmx.de> wrote in message news:99620@f...

RE: Re: [wxperl-users] Re: Re: EVT_QUERY_END_SESSION
you putted the EVT_CLOSE to the wrong place... or do you have a reason why you need it to be there? $app ist not the window, but you could use EVT_CLOSE on $frame too. i changed your minimal sample that it works. hope it helps greeting Marco ---- use Wx; ########################### package MyApp; use strict; use vars qw(@ISA); @ISA=qw(Wx::App); sub OnInit { my( $this ) = @_; my( $frame ) = MyFrame->new( "Minimal wxPerl app", Wx::Point->new( 50, 50 ), Wx::Size->new( 450, 350 ) ); ...

Re: Re: Re: Re: cross cluster read fails
--Boundary_(ID_HDBIpKP7HBB79jluGvYvuw) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 8BIT Content-disposition: inline �Hi Alan One more thing before we go further :) I wrote a simple perl script that accepts a file name, prints it out, opens the file (dies if open unsuccessful or prints �open successful�) 1>I passed my local directory filename, it prints �open successful� 2> Now I just add �abcd::� in front of it, and the perl script fails with Remote node is unknown D...

Re: Re: Re: RE: capture a website and process its data
--Next_1077222091---0-202.54.124.153-17281 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Rob,=0AI implemented your code and it gave perfectly desired answers. Bu= t I couldn't understand most of it. So, currently I went ahead with Dan's t= ips on my code only and would try to understand your code later after I mee= t a deadline for a small project of mine in college for tomorrow! So, no qu= estions as of now. =0A=0Acheers.=0AK(ay).=0A=0A=0AOn Thu, 19 Feb 2004 Rob D= ixon wrote :=0A>Scott E Robinso...

RE: RE: Re: Tri-grams?
------_=_NextPart_001_01C6380E.13FCCC91 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable -----Original Message----- From: amit hetawal [mailto:amit_h123@rediffmail.com] Sent: Wednesday, February 22, 2006 16:00 To: Wagner, David --- Senior Programmer Analyst --- WGO Subject: Re: RE: Re: Tri-grams? hi there the sequnce with alpha _ _ is valid but not _ _ _ I replaced the 4 four lines in your program with the following four line= s. =20 next if ( $char !~ /[a-z]/i ); my $char2 =3D substr $_, $ii+1, 1; ...

RE: Re: Re: Sub not working as it should
You don't need to be sorry - it's the right choice ;-) Philipp > -----Original Message----- > > I am sorry I am migrating over to perl (love the built > in debugger) > --- Saadat Saeed <saadat_saeed@yahoo.com> wrote: > > Thanks for the quick reponse - looks like I confuse > > my > > vbscript skills a bit... I am new to perl and am > > migrating over to vbscript! > > > > Regards > > > > > > --- Jeff 'japhy' Pinyan <japhy@perlmonk.org> wrote: > > > On Jan 21, Saadat S...

RE: Spam:Re: Using regular expressions
John, Lighten up matey... The examples I've given are just that examples... Error checking functionality is up the end programmer... (And you are quite right, you should check the status of operations.) This is a beginers list, let's keep it friendly, eh? .... and FWIW ... for my $line (<INFILE>) { # stuff } is equivalent to: while (my $line =3D <INFILE>) { # stuff } If you are going to correct me, at least get it right and do it in a friendly manner! ;) :P :) Regards, =20 Michael S. E. Kraus Software Developer Wild Technology Pty ...

Re: Re-inventing the wheel [was RE: Why not gmp? [was Re: pdd14 -- bignums] ]
Simon Cozens <simon@netthink.c To: Shlomi Fish <shlomif@vipe.technion.ac.il> o.uk> cc: perl6-internals@perl.org ...

RE: RE: RE: RE: [wxperl-users] wxTreeCtrl, edit an treeItem
>>Found a fix ( I hope ); download the modified wx22_9.dll from >>http://wwwstud.dsi.unive.it/~mbarbon/wx/wx22_9.dll.gz >>uncompress it and put it in $PERL/site/lib/auto/Wx >>( make a backup of the original one, of course ). >>This fixes your problem with tree control, but may introduce >>new ones ( it is a fix backported from wxWIndows 2.3 ). >> >>Regards >>Mattia > >hey thanks man! >i had no time to work on my application but i checked the wxwindows >mailinglist archive. you asked for a code change as workaround......

Web resources about - RE : RE : RE : Regular expressions - perl.beginners

Expression (sign language) - Wikipedia, the free encyclopedia
Signs with two different expressions. The pursed lips and partly closed eyes on the left, and raised lip on the right, are necessary for proper ...

Joe Rogan's Facial Expression After Ronda Rousey Got Knocked Out Was Priceless - Bleacher Report
Joe Rogan 's face spoke for us all Saturday night. After UFC superstar Ronda Rousey got knocked out by a lethal kick from Holly Holm, the commentator ...

Jack Dorsey: 'Twitter stands for freedom of expression'
Newly-instated CEO Jack Dorsey laid out Twitter's commitment to open dialogue, in a keynote on stage at today's Twitter Flight developer conference ...

Make your technology a force for musical expression with this digital guitar
Computers, tablets, even iPhones have grown into powerful tools for music making, but for many who play guitar the bridge from analog instrument ...

Disney's FaceDirector changes facial expressions in movies
The new tool out of Disney Research's labs could turn an ing&eacute;nue's semi-decent attempt into a finely nuanced performance. This software ...

Turkey's YouTube Ban Violated Freedom Of Expression, European Court Rules
A YouTube ban in Turkey that lasted two years has now been ruled a violation of the European Convention on Human Rights. Back in 2008, a Turkish ...

At Public School Sports, A Constant Test of Line Between Faith Expression and Establishment
Thefine line between expressing religious faith at a government-run institution and said institution endorsing that expression, and the argument ...

Smile!: Impressive Real-Time Facial Expression Transfer
This is a video from Stanford University of a system developed to transfer one person's facial expressions in real time to a live video feed ...

How Facial Recognition Uses Super-Simple Patterns to Understand Your Expression
Facial recognition systems use all kinds of clever software to work out who you are and even how you’re feeling. But in this video explainer, ...

Expressions of Solidarity for France in Red, White and Blue
ABC News Expressions of Solidarity for France in Red, White and Blue ABC News This photograph made available on Saturday Nov. 14, 2015, shows ...

Resources last updated: 12/24/2015 3:24:59 AM