About 100,000 results
Open links in new tab
    Upvotes268Top Answeranswered Nov 12, 2010 at 8:35

    Something like this would do:

    xargs cat <filenames.txt

    The xargs program reads its standard input, and for each line of input runs the cat program with the input lines as argument(s).

    If you really want to do this in a loop, you can:

    for fn in `cat filenames.txt`; do
    echo "the next file is $fn"
    cat $fn
    done
    Content Under CC-BY-SA license
    Was this helpful?
  1. Bash foreach loop - Stack Overflow

  2. How do I write a 'for' loop in Bash? - Stack Overflow

  3. Loop through an array of strings in Bash? - Stack Overflow

  4. How do I iterate over a range of numbers defined by variables in …

  5. How to iterate over arguments in a Bash script - Stack Overflow

  6. Looping through the content of a file in Bash - Stack Overflow

  7. People also ask
  8. bash shell nested for loop - Stack Overflow

  9. Executing for-each in bash - Stack Overflow

  10. How can I loop over the output of a shell command?

  11. How to iterate over associative arrays in Bash - Stack Overflow