Thursday, May 26, 2005

A thing about sed regex

Okay so on the left side you need to escape things like "(" "?" which are needed for example:

To remove - from -bash from ps axo command listing ,i needed to do this.

#ps axo command|sed -ne "1d;s/^-\(.*\)/\1/p"


And to make that thing optional,dont ask me why i did that ..yeah so to print all commands and to remove - from -bash when encountered.

#ps axo command|sed -ne "1d;s/^-\?\(.*\)/\1/p"

0 Comments:

Post a Comment

<< Home