use of comm and sort tools
Linux for blind general discussion
blinux-list at redhat.com
Thu May 12 12:14:38 UTC 2022
Tim here. If both files have been sorted, you can find just the
missing ones with
$ comm -23 mp3.txt m4a.txt
The "-23" means "things that aren't only in file 2, and things that
aren't in common".
If they're unsorted, I usually reach for awk:
$ awk 'NR==FNR{b[$0]; next} !($0 in b)' mp3.txt m4a.txt
(note the order reversal of the arguments: first it loads the list of
all the mp3s and then processes m4a.txt, emitting items that weren't
in the mp3 list)
Hope this helps,
-Tim
On May 12, 2022, Linux for blind general discussion wrote:
> I wrote previously about ffmpeg and audio variable bitrate. After
> conversion, there are some files that did not convert. I would like
> to compare two listings and discover which ones are missing. So, we
> have these commands: find . -type f -name \*.m4a | sed -e 's at .*/@@'
> -e 's/\.4a$//' > m4a.txt find raw2 -type f -name \*.mp3 | sed -e
> 's at .*/@@' -e 's/\.mp3$//' > mp3.txt Now I want to run comm and have
> it dump to another file which lines in m4a.txt do not exist in
> mp3.txt. How would I go about doing that? Or is there a better way?
>
> _______________________________________________
> Blinux-list mailing list
> Blinux-list at redhat.com
> https://listman.redhat.com/mailman/listinfo/blinux-list
>
More information about the Blinux-list
mailing list