is it possible to use sed with no options?

sed’s s command performs search-and-substitute. The following letter (here #) separates pattern, replacement and options. Note that regex pattern is taken greedy.

An example should clarify how it works

$ cat file.txt
abc
ab/c
a/b/c

$ sed 's#.*/##' file.txt
abc
c
c

So, text up to and including the last slash, if any, gets dropped

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top