Last Updated: February 25, 2016
·
615
· felipebrnd

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