parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to parallelize find|while read do; ffprobe, grep and get the filenam


From: D
Subject: How to parallelize find|while read do; ffprobe, grep and get the filenames?
Date: Sat, 12 Nov 2022 11:39:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

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?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]