ltym5q
Last Updated: February 25, 2016
·
449
· felipebrnd
35cc187075b514ffdbcc6b006b69714c

using sed to get file basedir

A “sed way” of extract the basedir of a given filename like /home/jj/stuffs/and/shit/tasks.txt:

echo /home/jj/stuffs/and/shit/tasks.txt | sed "s/\(.*\)\/.*$/\1/"

Output:

/home/jj/stuffs/and/shit

Say Thanks
Respond