each line

shell prompt image

running a command against every line in a textfile

So, you have a text file like so: file1 file2 .. And you want to run a command on each line of the file (say, chmod 644). Like all things UNIX, there are more than one way to do thing, but here’s the quick and dirty answer: xargs -0 -n 1 chmod 644 < <(tr \\n \\0 <filelist.txt)   So, this will run xargs on the std. input (filelist.txt). -n is max arguments – in…