bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sed problem?


From: Paul Parker
Subject: sed problem?
Date: Wed, 1 Oct 2003 05:54:10 -0500

using 3.02 version of sed on Caldera Linux version 2.4.2
runngin bash2 2.04.0(1)

I'm a newbe using sed but the following results seem wrong:

echo '50000' |  sed  -n 's/[^0-9]//gp' does not produce any output

echo '$50,000' |  sed -n 's/[^0-9]//gp' produces 50000 as output

echo '50000' |  sed  's/[^0-9]//gp'  produces 50000 as output

echo '$50,000' |  sed 's/[^0-9]//gp produces TWO values both 50000

so it would seem that the p option only produces output if a replacement
has actually occured.  In other words the p option produces output
only if the source string is actually changed in some way.

I would expect the p command with the -n option to produce output
even if there were no replacements made in the source string.  Without
the -n  option, both the original and resultant string (without any
replacements made) should be output

Is this a known problem?  Or is this the way its supposed to work?

-- 
Thanks, Paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]