Re: awk question





On Nov 26, 11:50 am, gaze...@xxxxxxxxxxxxxxxxxxxxx (Kenny McCormack)
wrote:
In article <474AEC7A.4080...@xxxxxxxxxxxxxx>,
Ed Morton <mor...@xxxxxxxxxxxxxx> wrote:
...





Anawkvariable? It doesn't look like it. Yourawkscript above will
print the first field from every record in the file "cool". Is that not
what you want yourawkscript to do? If not, then tell us what you want
it to do. If it is, then your problem is in how to capture the output
of thatawkscript when you execute it from your OS, and save it's
output in an OS variable. Those are NOTawkquestions, they're OS
questions. You can tell becaue you could replace "awk" with any tool
and get the same answer.

If you have a question about yourawkscript, ask it here as that's the
domain of expertise of the people who participate in this NG.

If you have a question about how to invokeawkFROM YOUR OS or capture
it's output IN YOUR OS, then ask in an OS-specific newsgroup because
it's not appropriate in this one and, more importantly, here you'll get
an answer fromawkexperts which may not be the right answer according
to the OS experts who frequent the OS NGs.

Ed.

Oooh Ed. You are just becoming so CLC-like. I am so impressed.

(Entirely seriously) I think you are really getting into it. Kudos!

And you are absolutely right, because the thing is - we could (all of
us) obviously give the Unix shell answer, but then, it's almost a
certainly that the OP would come back with: "Oh, I'm using
Windows/Commodore-64/whatever", and then where'd we be?

The advice to re-post in comp.unix.shell [1] is entirely sound.

[1] Assuming that we *are* talking about Unix at all...- Hide quoted text -

- Show quoted text -


This is how you do it :
myvariable=`awk '{print $1}' cool`

Good Luck
.