Hello,
I'm trying to parallelize my Bash shell script:
find . -type f -iname "*.flac" -print0 | while read -d $'\0' FILENAME; do
INFOS=$(ffprobe -hide_banner "$FILENAME" 2>&1)
URL=$("$INFOS"|& grep -i 'http\|www')
if [ "$URL" != "" ]; then
echo -e "$FILENAME\t$URL"
fi
done | column -t -s $'\t'
So I did this:
find . -type f -iname "*.flac" -print0 | while read -d $'\0' FILENAME; do
INFOS=$(parallel -0 ffprobe -hide_banner "{}" 2>&1)
URL=$("$INFOS"|& grep -i 'artist')
if [ "$URL" != "" ]; then
echo -e "$FILENAME\t$URL"
fi
done | column -t -s $'\t'
And while this runs approximately 6 times faster now (I have a 6c/12t
CPU), unfortunately the output contains the file name only once at the
beginning/top. How to fix this and can my script be further
improved/corrected?