[GLLUG] why doesn't this work?

Marshal Newrock marshal at simons-rock.edu
Thu Oct 23 19:12:17 EDT 2003


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;
>
> but all I get is:
>
> cat: building.mysql: No such file or directory
> cat: dept.mysql: No such file or directory
> cat: equipment.mysql: No such file or directory
> cat: guest.mysql: No such file or directory
> cat: inventory.mysql: No such file or directory
> cat: itech.mysql: No such file or directory
> cat: itstaff.mysql: No such file or directory
> cat: partused.mysql: No such file or directory
> cat: repair.mysql: No such file or directory
> cat: vardat.mysql: No such file or directory
>
> The $TARGET variable clearly contains all the filenames in the directory
> but the cat command for some reason can't find them in this context.
> What have I missed?

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.

-- 
Marshal Newrock, unemployed Linux user in Lansing, MI
Caution: Product will be hot after heating



More information about the linux-user mailing list