|
|
Up |
|
|
  |
Author: PrateekPrateek
Date: Sep 20, 2008 05:19
Hi,
My question is how are the outputs same for the two below queries.
First has 'print $0, NF' and the other 'print NF, $0'; 'print NF, $0'
is working as expected but not 'print $0, NF'; Can someone please
explain.
grampian@/export/home/sys1mi/delete_1--->gawk '/N_APPL_SYST_CPNT/
{print $0, NF}' *
4 N_APPL_SYST_CPNT number := 35;
8 from prwmgr.appl_syst_cpnt_run@spartap where
appl_syst_cpnt_id=N_APPL_SYST_CPNT...
|
| Show full article (2.26Kb) |
|
| |
3 Comments |
|
  |
|
|
  |
Author: SebSeb
Date: Sep 17, 2008 12:18
Hi,
Given 2 files file1 and file2, each with a single field made of rows
like 't010203.txt', does this:
awk 'NR == FNR {r[$0]=$0}; NR != FNR {if (!$0 in r) print $0}' file1 file2
output the lines in file2 that were not present in file1? I'm pretty
sure it does, but was wondering if there's a better way to do it or
whether I'm overlooking something. My main doubt is the use of '!' in
the 'if' statement.
Cheers,
--
Seb
|
| |
|
10 Comments |
|
  |
Author: nhgokulprasadnhgokulprasad
Date: Sep 16, 2008 00:53
Hi,
A box
B box
xyz(command)
if box A and B responds ok for the xyz command thats fine and if any
one of the box gives not ok response i want to kill one app
process(like pgrep app).
Am newbie in awk, i think using awk would be elegant in this
situtation. Please help me
Regards,
Gokul
|
| |
|
3 Comments |
|
  |
Author: Kenny McCormackKenny McCormack
Date: Sep 15, 2008 13:40
In article 34g2000hsh.googlegroups.com>,
gmail.com> wrote:
>> If I understand you correctly, your "reason for posting" is that you've
>> hacked up a "script kludge" way of doing what you want, and are now asking
>> the maintainers if they would consider implementing this functionality
>> in the "core" (i.e., in the C source code). Is that correct?
>
>Nope. (really?) Not in the way you stated it. (really?) I don't see
>anything wrong asking the forum or even maintainers for a missing
>option, when sed has implemented it for quite some time, and an option
>that many people find it useful and asking for. That reason is clearly
>posted in the last part of the thread.
How is this different from what I said?
|
| |
|
no comments
|
|
  |
Author: Ed MortonEd Morton
Date: Sep 15, 2008 13:32
On 9/14/2008 4:25 PM, rubin1001@ gmail.com wrote:
>> If I understand you correctly, your "reason for posting" is that you've
>> hacked up a "script kludge" way of doing what you want, and are now asking
>> the maintainers if they would consider implementing this functionality
>> in the "core" (i.e., in the C source code). Is that correct?
>
>
> Nope. Not in the way you stated it. I don't see anything wrong asking
> the forum or even maintainers for a missing option, when sed has
> implemented it for quite some time, and an option that many people
> find it useful and asking for. That reason is clearly posted in the
> last part of the thread.
> AFAIK the same "kludge" concept is silently used in sed -i, and
> surely it can do more than sed.
>
>
>
>
>> 1) As far as I'm concerned, the "right way" to do this (*) is to
>> store up the results in an array, then, in the END block, ...
|
| Show full article (3.10Kb) |
|
no comments
|
|
  |
Author: Amy LeeAmy Lee
Date: Sep 11, 2008 07:24
Hello,
I'm a newbie at awk and I need this for some work. There's a data sheet I
process.
A1 0.65 3
A2 0.33 5
A3 0.55 5
.........
And I hope add a new column at the end and fill up with "matched" words.
So there are 4 columns divided by space. The result should be this.
A1 0.65 3 matched
A2 0.33 5 matched
A3 0.55 5 matched
.................
Thank you very much~
Regards,
Amy
|
| |
|
4 Comments |
|
  |
Author: misherymishery
Date: Sep 10, 2008 01:32
I am a relative novice with awk and am stuck on something I can't help
thinking ought to be really simple. I have a file "mydata.txt" as
below
a 999
b 1000
c 1001
d 1002
I am trying to write a simple script that will output the following
from this file
a 999
b 1000 a 999
c 1001 b 1000
d 1002 c 1001
I just can't seem to do this, but it must be really simple, no?
Thanks
|
| |
|
8 Comments |
|
  |
Author: William SeivertWilliam Seivert
Date: Sep 6, 2008 12:54
Hi,
What does the POSIX Standard for awk say about coercion as described on
pages 44-45 of The Awk Programming Language book (1988, Aho, Weinberger,
Kernighan)?
I.e., "" variable is treated as a string, 0 + variable is treated as a
number.
Thanks.
Bill Seivert
|
| |
|
2 Comments |
|
  |
|
|
  |
Author: nt4-evernt4-ever
Date: Sep 4, 2008 16:13
gawk doc error - awk eval error
what was a simple gawk doc error lead to a serious awk
arg evaluation error in awk/gawk but Not in mawk
the 1999 gawk.hlp or latest gawk.html
http://www.weihenstephan.de/~syring/win32/UnxUtilsHlp.zip
http://www.gnu.org/software/gawk/manual/
say in section: 'Calling Built-in Functions'
i=5; j=atan2(i++, i *= 2)
"If the order of evaluation is left to right, then i first becomes
six, and then 12, and atan2 is called with the two arguments
six and 12. But if the order of evaluation is right to left, i first
becomes 10, and then 11, and atan2 is called with the two
arguments 11 and 10."
since i++ yields value of i and then incs i, statement should be:
'called with arguments five and 12' 'or 10 and 10' ???
|
| Show full article (1.94Kb) |
|
5 Comments |
|
|
|
|
|
|