Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Name: tvc
Often found myself writing commands similar to this:
<whatever command> | awk -F"a=" ' { print $2 } ' | awk ' { print "a=" $1 } ' > temp.sh
This to create another shell script, which subsequently can get run, in this case to initiate variable "a" with a given value, which then further can be used inside the same script.
I know you can this for example:
thisuser=`id -un`
This would fill in a variable, with the result of the command. I've tried to do the similar, starting from the above (large) command, which would be something like this:
`<whatever command> | awk -F"a=" ' { print $2 } ' | awk ' { print "a=" $1 } '`
But, this does not always work. Question is, how do you do these kind of things, WITHOUT using a temporary file ? (so, WITHOUT redirection to a file)
Feel free to ask if you do not understand, it's a bit of a complex thing

If I have a file (in this example, we'll call it junk.file) with one field and that field has the value of ls, then all I have to do to run the ls command is type:
$(awk '{print $1}' junk.file)
So if I'm understanding your question properly, all you want to do is run the output of your awk command. If so, this should work from the Korn shell.

![]() |
file parsing
|
Scripting Problem
|
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |