[GLLUG] why doesn't this work?
Bong Munoz
bong at techie.com
Thu Oct 23 22:57:18 EDT 2003
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?
"ls -1" returns the one filename per line so you can omit awk. I tried
it this way and I can concatenate all files into a single file. Even
shorter is the standard: cat *.mysql >>makeall.mysql.
--bong
More information about the linux-user
mailing list