Problem opening sed pipe

F

freewilly3d

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?
 
U

Uri Guttman

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
 
G

Glenn Jackman

freewilly3d said:
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.
 
T

Tad McClellan

freewilly3d said:
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.
 
M

Michele Dondi

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
 
T

Tintin

freewilly3d said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top