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
Written by Felipe Brandão
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#