Work with filenames listed in a file

If you have a text file with a number of line-seperated filenames, you can do the following to manipulate them:

cat thefile.txt | while read line; do ls "$line"; done

That example will simply run ls on each filename in the text file.

Last modified: 10/06/2008 Tags:

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top