Problem opening sed pipe

Discussion in 'Perl Misc' started by freewilly3d, Feb 13, 2004.

  1. freewilly3d

    freewilly3d Guest

    I'm trying to open the following pipe in perl open(SASPS,"ps -
    ef|sed 's/^\(.\{32\}\) /\1/; s/^ *$/*/'|grep sas| sort +0 -1 -d +7 -
    8 -d +4 -5 -d +6 -7 -d |") and get a sed error returned. The command
    works fine at the command line. The error has something to do with
    th *$/ part of the code. This is the message I get back
    adwprod:/prod/rptg/bstandke >pssas
    sed: 0602-404 Function s/^(.{32}) //; s/^ * cannot be parsed.
    any suggestions?
     
    freewilly3d, Feb 13, 2004
    #1
    1. Advertising

  2. freewilly3d

    Uri Guttman Guest

    >>>>> "f" == freewilly3d <> writes:

    f> I'm trying to open the following pipe in perl open(SASPS,"ps -
    f> ef|sed 's/^\(.\{32\}\) /\1/; s/^ *$/*/'|grep sas| sort +0 -1 -d +7 -
    f> 8 -d +4 -5 -d +6 -7 -d |") and get a sed error returned. The command
    f> works fine at the command line. The error has something to do with
    f> th *$/ part of the code. This is the message I get back
    f> adwprod:/prod/rptg/bstandke >pssas
    f> sed: 0602-404 Function s/^(.{32}) //; s/^ * cannot be parsed.
    f> any suggestions?

    yes, do it all in perl. that code is a waste of good cpu. and even the
    ps part can be done with a module.

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
     
    Uri Guttman, Feb 13, 2004
    #2
    1. Advertising

  3. freewilly3d <> wrote:
    > I'm trying to open the following pipe in perl open(SASPS,"ps -
    > ef|sed 's/^\(.\{32\}\) /\1/; s/^ *$/*/'|grep sas| sort +0 -1 -d +7 -
    > 8 -d +4 -5 -d +6 -7 -d |") and get a sed error returned. The command
    > works fine at the command line. The error has something to do with
    > th *$/ part of the code. This is the message I get back
    > adwprod:/prod/rptg/bstandke >pssas
    > sed: 0602-404 Function s/^(.{32}) //; s/^ * cannot be parsed.
    > any suggestions?


    Escape the dollar sign, or put the whole command in q{} instead of
    double quotes.

    --
    Glenn Jackman
    NCF Sysadmin
     
    Glenn Jackman, Feb 13, 2004
    #3
  4. freewilly3d <> wrote:

    > open(SASPS,"ps -
    > ef|sed 's/^\(.\{32\}\) /\1/; s/^ *$/*/'|grep sas| sort +0 -1 -d +7 -
    > 8 -d +4 -5 -d +6 -7 -d |")


    > any suggestions?



    Print out the argument that you are passing to open().

    Then read up on the $/ variable.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Feb 13, 2004
    #4
  5. On 12 Feb 2004 17:41:39 -0800, (freewilly3d)
    wrote:

    >I'm trying to open the following pipe in perl open(SASPS,"ps -
    >ef|sed 's/^\(.\{32\}\) /\1/; s/^ *$/*/'|grep sas| sort +0 -1 -d +7 -
    >8 -d +4 -5 -d +6 -7 -d |") and get a sed error returned. The command


    Grrrr! What the f**king point is there in using sed in a pipe in a
    perl script?!? Do it all in perl, period!


    Michele
    --
    you'll see that it shouldn't be so. AND, the writting as usuall is
    fantastic incompetent. To illustrate, i quote:
    - Xah Lee trolling on clpmisc,
    "perl bug File::Basename and Perl's nature"
     
    Michele Dondi, Feb 13, 2004
    #5
  6. freewilly3d

    Tintin Guest

    "freewilly3d" <> wrote in message
    news:...
    > I'm trying to open the following pipe in perl open(SASPS,"ps -
    > ef|sed 's/^\(.\{32\}\) /\1/; s/^ *$/*/'|grep sas| sort +0 -1 -d +7 -
    > 8 -d +4 -5 -d +6 -7 -d |") and get a sed error returned. The command
    > works fine at the command line. The error has something to do with
    > th *$/ part of the code. This is the message I get back
    > adwprod:/prod/rptg/bstandke >pssas
    > sed: 0602-404 Function s/^(.{32}) //; s/^ * cannot be parsed.
    > any suggestions?


    Replace the first line in your script with

    #!/bin/sh
     
    Tintin, Feb 15, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John K. Humkey

    sed regexp mystery

    John K. Humkey, Jul 8, 2003, in forum: Perl
    Replies:
    0
    Views:
    2,048
    John K. Humkey
    Jul 8, 2003
  2. NNTP

    sed awk or perl for this?

    NNTP, Sep 11, 2003, in forum: Perl
    Replies:
    13
    Views:
    3,478
    Alan Connor
    Sep 30, 2003
  3. lee, wonsun
    Replies:
    1
    Views:
    490
    Jack Klein
    Nov 2, 2004
  4. hofer
    Replies:
    11
    Views:
    2,636
  5. Replies:
    1
    Views:
    227
    Ben Morrow
    Jun 2, 2004
Loading...

Share This Page