1
0
I have a directory and many more subdirectories like the following -
file with spaces.txt
filewithsuperlonglines.txt
ordinaryfile.txt
binaryfile.bin
The command -
find . -type f -print0 | xargs -0 file | grep text | grep -v long | cut -d: -f1
produces the correct list of files (i.e. text files that do not contain very long lines)
./file with spaces.txt
./ordinaryfile.txt
But when I add another xargs to the end of the command I get errors -
find . -type f -print0 | xargs -0 file | grep text | grep -v long | cut -d: -f1 | xargs -0 awk -f someprocessing.awk
gawk: someprocessing.awk:3: fatal: cannot open file `./file' for reading (No such file or directory)
The content of someprocessing.awk is not relevant as I get the same error if I use the cat
command instead.
How do I get the command after the last pipe to work with files with spaces in their names?