Artificial intelligent assistant

cut+sed function joined **Input** dir/foo **Output** dir./ so I need: echo 'dir/foo' | MAGIC **Q:** What is `MAGIC`? (something like a `cut`+`sed` joined:D)

You have a few options here. My preference would be towards a parameter expansion:


foo=dir/foo
echo "${foo%/*}./"


Another option is awk:


echo "dir/foo" | awk -F/ '{ print $1"./" }'

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 3d44f148fbc149243fa5764eded4910f