7

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?

Community
  • 1
  • 1
Tomek Wyderka
  • 1,425
  • 1
  • 15
  • 21
  • 1
    This question has already been answered at least once before. This should explain things clearly: http://stackoverflow.com/questions/1797906/sed-delete-using-a-different-delimiter – Steve Nov 29 '12 at 07:23

1 Answers1

11

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

/address/

or

\|address|
alinsoar
  • 15,386
  • 4
  • 57
  • 74