awk -- Input file not in command line

April 26, 2011 at 12:52:52
Specs: unix AIX
I see several files read into arrays. However, two of the files aren't in the command line.
The below example is one of the files not in the command line.
Is is possible to read a file without it being in the command line?

awk code :
FILENAME=="exUsoc.dat"{
exUsoc[$1]=1
next}


See More: awk -- Input file not in command line

Report •


#1
April 26, 2011 at 14:26:52
You can read text files into an array using the getline function, but FILENAME is the name of the current input file. To me that means this code block:

FILENAME=="exUsoc.dat"{
exUsoc[$1]=1
next}

will never be true unless the exUsoc.dat file is on the command line.

Let me know if I've misinterpreted your question.


Report •
Related Solutions


Ask Question