🌱 xargs

Source

Move all the .c files to the “temp” directory:

#!/bin/bash
find . -name "*.c" -print0 | xargs -0 -n1  -I '{}' mv '{}' temp

The usage of -I. The option -I is followed by a string which in this case is '{}'. This -I tells to  replace the occurence of the string in the argument list with the names read from the standard input.

If the .c files present are f1.c and f2.c, the above xargs command will translate to:

mv f1.c temp
mv f2.c temp
Made by Brandon . If you find this project useful you can donate.