Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sed delete line with file path [duplicate]

Tags:

sed

Possible Duplicate:
sed: delete using a different delimiter

I can substitute line in file like this

sed "s|$PATH_WITH_SLASH||" file

but I cannot delete it

sed "|$PATH_WITH_SLASH|d"  file

The problem is that | character cannot be used for deletion. Why?

like image 947
Tomek Wyderka Avatar asked Nov 29 '12 07:11

Tomek Wyderka


1 Answers

If you use other character as address delimiter, you need to use backslash before the first char. So

/address/

or

\|address|
like image 100
alinsoar Avatar answered Nov 10 '22 09:11

alinsoar