PDA

View Full Version : Want awk to use scripts from user directory


frankc01
09-09-2009, 06:21 AM
I am running awk, for the first time, and i want to invoke from terminal such as:

awk -f mystuff.awk infile

I created a directory off of $HOME called clscripts (e.g. ~/clscripts) and have exported this in both PATH and AWKPATH in my .bash_profile.

When I open a new terminal window and try the above command, it complains about not finding mystuff.awk even though it is in ~/clscripts

Running OS X - Snow Leopard

Any help would be appreciated, sorry for the noop level question
Frank

hayne
09-09-2009, 09:39 AM
You seem to be thinking that 'awk' will look in your execution PATH to find the files referred to via "-f". That is not the case - you need to specify the file via its full pathname.

frankc01
09-09-2009, 03:16 PM
OK,

I was looking at "gawk" online and I assumed because it used the AWKPATH environment, that "awk" would as well. Interesting how they didn't use "GAWKPATH"... maybe it looked to funky...

Thanks for the reply

Frank