Hello, everyone!
I have the following problem. I've a file containing lots of similar string, actually they are a paths to files. I need to remove the filename from it. Just can't figure out how to do that.
So, for clearance, there is an example input file
in1:
Code:
./.VirtualBox/Machines/eData/Logs/VBox.log
./.gftp/gftp.log
./.kde/share/apps/kconf_update/log/update.log
I need to remove patterns in
bold, so the result should be:
Code:
./.VirtualBox/Machines/eData/Logs/
./.gftp/
./.kde/share/apps/kconf_update/log/
I figured out how to get only filenames, that is easily reached by the following command:
sed s/^.*\\/// in1
I've tried to do so to guess inverse
sed s/\\/.*$// in1, but that leads only to the following output:
What am I doing wrong?