comp.lang.awk
  Home FAQ Contact Sign in
comp.lang.awk only
 
Advanced search
September 2008
motuwethfrsasuw
1234567 36
891011121314 37
15161718192021 38
22232425262728 39
2930      40
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.awk Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  ($0, NF) same as (NF, $0) ???         


Author: Prateek
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
  Finding the Latest File         


Author: dnlchen
Date: Sep 18, 2008 18:12

Input:



Index of /pub/testenv on <a href="http://test.example.com:21" rel="nofollow" class="url" target="_blank">test.example.com:21</a>


Index of /pub/testenv on test.example.com:21





2008 Sep 18 23:53 File ftp://test.example.com:21/
pub/testenv/.bash_history">.bash_history (2885 bytes)
2008 Sep 03 15:48 Directory ftp://test.example.com:21/
pub/testenv/.ssh/">.ssh/
2008 Jun 27 22:40 Directory ftp://test.example.com:21/
pub/testenv/.subversion/">.subversion/
2008 Jul 28 18:38 File ftp://test.example.com:21/
pub/testenv/.viminfo">.viminfo (5884 bytes)
2008 Sep 05 18:59 File ftp://test.example.com:21/
pub/testenv/abcd.0.256.3.tar.gz">ass.0.256.3.tar.gz (96594844 ...
Show full article (1.59Kb)
1 Comment
  set comparisons         


Author: Seb
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
  awk script         


Author: nhgokulprasad
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
  Re: AWK-Editing files in "place" and a --write switch         


Author: Kenny 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
  Re: AWK-Editing files in "place" and a --write switch         


Author: Ed 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
  Help: How to add a column         


Author: Amy 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
  Print current line and previous line         


Author: mishery
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
  POSIX Awk Coercion         


Author: William 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
  gawk doc error - awk eval error         


Author: nt4-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
1 2 3 4 5 6 7 8 9