Re: truncate until delimiter
Vadkan Jozsef wrote:
$ ls -tr `find -type f` | grep ".txt$" | rev
I Want to truncate this output, until the first "/":
$ ls -tr `find -type f` | grep ".txt$" | rev | THE-MAGIC-COMES-HERE
You could use "cut -d/ -f1".
I just want to modify the names of some files, but I can't do it if they
have their full path "in their names"..
In this case there is an easier command called "basename".
But there are some better possibilities. "find" knows options like
"-name" (replaces your grep) and "-printf" (replaces your ls -tr, rev
and the magic one)