Find missing files but with same file name

Ralf Mardorf silver.bullet at zoho.com
Sun May 22 06:28:03 UTC 2016


On Sun, 22 May 2016 08:16:40 +0200, Ralf Mardorf wrote:
>You could format the output of the file, e.g.
>
>$ cat ~/Desktop/findsn.txt 
>-rw-r--r-- 1 rocketmouse rocketmouse 0 May 22 08:10 pics_1/faked.jpg
>-rw-r--r-- 1 rocketmouse rocketmouse 0 May 22 08:10 pics_2/faked.jpg
>
>$ cut -d" " -f9 ~/Desktop/findsn.txt 
>pics_1/faked.jpg
>pics_2/faked.jpg
>
>$ cut -d" " -f9 ~/Desktop/findsn.txt >> formatted_findsn.txt
>
>$ cat formatted_findsn.txt
>pics_1/faked.jpg
>pics_2/faked.jpg

More easy to do things with shell scripts:

$ head -n1 formatted_findsn.txt
pics_1/faked.jpg

$ tail -n1 formatted_findsn.txt
pics_2/faked.jpg

$ basename $(head -n1 formatted_findsn.txt)
faked.jpg

$ dirname $(cat formatted_findsn.txt)
pics_1
pics_2





More information about the ubuntu-users mailing list