RE : RE : RE : RE : Regular expressions

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default 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 -> bsh
    49672 -> /usr/dt/bin/dtterm
    50170 -> /usr/dt/bin/dtlogin
    50400 -> dtterm
    50604 -> dispscript
    50844 -> genie
    51096 -> /prog/gena/8.1.1/bin/dispatch
    51348 -> gmap
    51676 -> reproject
    51874 -> gxtrackd
    52086 -> ps
    52378 -> perl
    52646 -> sh
    53164 -> /usr/bin/ksh
    53432 -> /bin/bsh

    Like $cmd will stop at the end of the word, not the end of the rest of the line.

    Steve Hemond
    Programmeur Analyste / Analyst Programmer
    Smurfit-Stone, Ressources Forestières
    La Tuque, P.Q.
    Tel.: (819) 676-8100 X2833
    [email]shemond@smurfit.com[/email]


    > -----Original Message-----
    > From: drieux [mailto:drieux@wetware.com]
    > Sent: Wednesday, December 17, 2003 1:24 PM
    > To: Perl Perl
    > Subject: Re: RE : RE : RE : Regular expressions
    >
    >
    >
    > 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
    >
    > ---
    >
    >
    > --
    > To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    > For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    <http://learn.perl.org/> <http://learn.perl.org/first-response>

    Steve Hemond Guest

  2. Similar Questions and Discussions

    1. 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.) ...
    2. [PHP] Q on Regular Expressions
      * Thus wrote jsWalter (jsWalter@torres.ws): have you looked at strtotime()? http://php.net/strtotime The Date formats it can find are defined...
    3. [PHP-DEV] PHP regular expressions
      Hello. In regex/utils.h there is a definition for DUPMAX: #ifdef _POSIX2_RE_DUP_MAX #define DUPMAX _POSIX2_RE_DUP_MAX #else #define DUPMAX 255...
    4. Help with regular expressions.
      Apples and Oranges: I think your format string is wrong, try: {0:d} "Pablo Pecora" <pablo.pecora@itau.com.ar> wrote in message...
    5. help with regular expressions
      Hello, just getting grips with Perl and RE, but need your help. I am trying to open a file, print its contents to a textbox, but extract...
  3. #2

    Default RE : RE : RE : RE : Regular expressions

    No worries :-)

    It works now, thanks a lot :-)

    Best regards,

    Steve Hemond
    Programmeur Analyste / Analyst Programmer
    Smurfit-Stone, Ressources Forestières
    La Tuque, P.Q.
    Tel.: (819) 676-8100 X2833
    [email]shemond@smurfit.com[/email]


    > -----Original Message-----
    > From: drieux [mailto:drieux@wetware.com]
    > Sent: Wednesday, December 17, 2003 1:38 PM
    > To: Perl Perl
    > Subject: Re: RE : RE : RE : Regular expressions
    >
    >
    >
    > 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
    >
    > ---
    >
    >
    > --
    > To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    > For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    <http://learn.perl.org/> <http://learn.perl.org/first-response>

    Steve Hemond Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139