Stupid sed tricks
October 17th, 2005 Posted in Simple Tips
I just learned that you can use any character, not just the slash (/), for a delimitter when substituting with sed. Most unique characters should work.
This is especially useful when editing streams of file paths.
Here’s an example that modifies the path in a playlist:
cat list.m3u | sed ’s+/home/aolsen/+~/+’
The +’s worked well as a delimitter here and eliminate the need to quote the /’s
This also works in vi.
–Anton