Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
could I pass awk variable to shell?
Name: zhynxn Date: July 4, 2006 at 08:54:22 Pacific OS: FC5 CPU/Ram: 1G Product: Fedora
Comment:
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
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.
Name: nails Date: July 5, 2006 at 09:30:37 Pacific
Reply:
You've embedded FILENAME in quotes so awk just treats it as another literal string. This example buils an execution string with FILENAME outside the quotes so it's treated as a variable:
Summary: How do I pass a variable declared in main to a function that runs when I click a button in Visual Studio .NET 2003? I've tried to make it public.. When I try to place it outside the class I get "cann...
Summary: Why doesn't the following function work? I need to pass 2 vars to the iw3mp.exe. Each has there own internal name, in this case, +connect and +password. I need to pass the var Password to +password an...