Sed command help

sed -e 's,/.*/,,' 

What does this s, substitution do?

removes all directories before filename assuming absolute path of filename is given , equivalent of basename command but doesn't handle relative paths

1 Like

Try this and you will know what it does :slight_smile:

echo "/ab/abc/abcd"| sed 's,/.*/,,'
1 Like

Hi,

Here the separator is /

sed 's/a/e/g' file

Here the separator is ,

sed 's,a,e,g' file

Both the above statements are same.

Cheers,
Ranga:)

1 Like

@rangarasan : he is correct in his words ,

Here seperator used is , instead of / . since / may conflict with directory search. :stuck_out_tongue:

1 Like