I don't understand the ls -al | awk ...
analogy. What is the point of including this code example?
If you have a whitespace delimited list of arguments, using a utility command like xargs
will supply each argument to a command one-by-one by default. You can change this default behavior, but it doesn't seem like that you'd need to. You can use xargs
as follows...
ls -al | awk '{print $9}' | xargs cat
...to cat
the contents of each file output by the ls -al
command. Does this help?
It should be noted though that ls
is a porcelain command and not a plumbing command. In other words, it is best practice to not rely on the output of ls
for a command pipeline. A utility like find
, however, is a plumbing command and is preferable to use as a part of a pipeline.