I have a program that returns me a list of file names. I need to pass these file's contents to another program.
I know how to use cat to pass content:
cat file1 file2 file3 | some_program
what I want to do is something like:
list=`get_file_list`
cat ${list} | some_program
Though doing the above will simply pass the content of the list variable, rather than the files' content.
To pass the output of,a program to another you can use xargs, for example
find . -name "myfile*" -print | xargs grep "myword" $1
This one searches for files called myfile* and look for a key inside of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With