Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with sed (multiple commands -e) 1

Status
Not open for further replies.

Kipnep70

Technical User
Nov 18, 2003
81
US
I know this is an awk forum, however I know many of you know sed fairly well and there isn't a sed forum on tek tips -- so if anybody could help me out I would appreciate it.

I'm trying to run one instance of sed instead of using piping. This is what I got so far ...

Code:
bpmedialist -summary | sed -n -e 's/U[0-9]/&/p' -e 's/(FROZEN)//g' -e 's/^[ \t]*//' | more

However, this produces the following below... (It doesn't remove whitespace from the beginning of the line and it doesn't remove "(FROZEN)".

U03784 (FROZEN)
U03057 (FROZEN)
U00994 (FROZEN)
U03073 (FROZEN)
U00989 (FROZEN)
U00961 (FROZEN)
U00990 (FROZEN)
U00988 (FROZEN)


...but when pipe sed to sed then it works.

Code:
bpmedialist -summary | sed -n 's/U[0-9]/&/p' | sed -e 's/(FROZEN)//g' -e 's/^[ \t]*//' | more

I get the following:

U03784
U03057
U00994
U03073
U00989
U00961
U00990
U00988
U02379
U02999
U00991
U00993
U03029
U00992


What am I missing ?

Thanks
 
bpmedialist -summary | sed -n -e 's/^[ \t]*//' -e 's/(FROZEN)//g' -e '/U[0-9]/p'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top