[GLLUG] why doesn't this work?

Jeffrey Utter utterjef at msu.edu
Thu Oct 23 16:11:51 EDT 2003


Well it works for me.  I tested it.

$ ls -l | awk {'print $9'} 

file1
file2
file3
$ for TARGET in `ls -l | awk {'print $9'}`;
> do cat $TARGET >> OUPUT;
> done;
$ more OUPUT
file 1
file 2
file 3


I would ask a few questions such as, are you doing this in a script?
if yes, where is the script in relation to the files you are combining?

so more info is needed on your situation i think..

On Thu, Oct 23, 2003 at 01:54:27PM -0400, 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?
> 
> I know that I can do the same thing one file at a time (and probably
> will shortly) but I'd sure like to know why this doesn't work.
> 
> Thanks.
> 
> 
> -- 
> Mike Rambo
> mrambo at lsd.k12.mi.us
> 
> NOTE: In order to control energy costs the light at the end 
> of the tunnel has been shut off until further notice...
> 
> _______________________________________________
> linux-user mailing list
> linux-user at egr.msu.edu
> http://www.egr.msu.edu/mailman/listinfo/linux-user

-- 
Jeffrey Utter
--------------------------------------------------------------------------------
  "If a man is a fool, you don't train him out of being a fool by sending 
   him to university. You merely turn him into a trained fool, ten times 
   more dangerous." --Desmond Bagley.


More information about the linux-user mailing list