For Programmers: Free Programming Magazines  


Home > Archive > AWK > July 2006 > could system command use built-in variable?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author could system command use built-in variable?
zhynxn

2006-07-03, 3:54 pm

I wanna use a system function to deal with several data, and I use built-in variable FILENAME to denote the it in system command, but it does not work. How can I do it?
My code is as follows:
#try.awk

{system("./out_function -t FILENAME > ./dst/FILENAME")
print FILENAME
nextfile
}

I use command ---awk -f try.awk ./src/* --- to run it. I found that system("command") could not recongnize FILENAME, so it could not run correctly. However, my test command--print FILENAME-- runs correctly.
How should I do to solve this problem? Thanks a lot.
zhynxn

2006-07-04, 9:57 am

I wanna use a system function to deal with several data. So I use awk variable FILENAME to transfer the file directory to system command, but it does not work.

I use a shell function "out_function" to deal with data and save the result in another directory with the same file name.
How can I do it?
My code is as follows:
#try.awk

{system("./out_function FILENAME > ./dst/FILENAME")
print FILENAME
nextfile
}

I use command ---awk -f try.awk ./src/* --- to open data files. I found that system("
command") could not recongnize FILENAME, so it could not run correctly. How
ever, my test command--print FILENAME-- runs correctly.
How should I do to solve this problem? Thanks a lot.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com