
June 29th, 2011, 04:37 PM
|
|
|
|
First problem - where does $VAR come from?
Why are you doing that first loop which will only (once it runs correctly) ever produce a result that you can use from the last iteration.
Let's go back to basics. You have a directory, containing files whose names follow a particular pattern. Show a couple of examples of the names. You mention the files have two columns which you wish to do some operations upon. Show a couple of examples of the content. Also, do the files contain just one line or many? If many do you want the operation to be performed on all or just some of those lines?
Don't use awk < a_file_name '{print $1}' - use: awk '{print $1}' a_file_name
You refer to file names ($VAR and XXXX_table.txt) without a path, then do a change directory (in a loop, which is a redundant thing to do!).
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc
|