[GLLUG] why doesn't this work?

Ben Pfaff blp at cs.stanford.edu
Fri Oct 24 18:40:25 EDT 2003


Bong Munoz <bong at techie.com> writes:

> Marshal Newrock wrote:
> > On Thu, 23 Oct 2003, Mike Rambo wrote:
> >
> >>I'm trying to combine the text of all files in a directory into one
> >>large file with the one liner:
> >>
> >>for TARGET in `ls | awk {'print $9'}`; do cat $TARGET >> makeAll.mysql;
> >>done;
> > That is indeed puzzling.  I can think of two possible things: 1)
> > that the
> > files are symlinks to other files, which are missing, or 2) that the
> > filenames contain non-printable characters.  See what 'ls -lQ' says.
> 
> Mike, why not omit awk from the one-liner: for target in `ls -1`; do
> cat $target >>makeall.mysql; done?

The really puzzling thing to me is how `ls -l | awk {'print $9'}`
is better than, or different from, "*".  Not to mention how the
given `for' loop is better than "cat * > makeAll.mysql".


More information about the linux-user mailing list