Friday, February 18, 2022

[SOLVED] Parallel version of find command on Linux

Issue

On zsh shell, I put into my ~/.zshrc the following function :

ff () {
    parallel -j8 find {} -type f ::: $1/* | grep -i $2
}

The goal is to do a "parallel" version of classical find function.

But unfortunately, it doesn't seem to work : for example, in a directory containing R scripts, I am doing :

ff . '*.R'

But this command doesn't return anything. What is wrong with my function ff?


Solution

By default grep uses basic regular expressions, so calling the function with another asterisk should work

ff . '**.R'

to ignore files like foo.r.bar

ff . '**.R$'


Answered By - SirNoob
Answer Checked By - Willingham (WPSolving Volunteer)