Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Re: matching co...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 15 of 26 Topic 2199 of 2236
Post > Topic >>

Re: matching column variables from two awks!

by spacegoose <spacegoose@[EMAIL PROTECTED] > Mar 22, 2008 at 07:37 AM

> That seems impossible.
>
> Are you SURE you copy/pasted what I posted into files rather than
retyping it? I
>  suspect your version of "myFile" is NOT the same one I posted.
>
> Do this:
>
> cat df_out
> cat myFile
> awk '{print FILENAME,$FNR,$0}' myFile df_out
>
> and copy/paste the result into a posting so we can see what you're
working with.
>
>         Ed.

I am running Solaris 10. Also tried on Solaris 9 -same result.

xxx@[EMAIL PROTECTED]
 cat df_out
/dev/md/ds/dsk/x20   200G   129G    69G    66%    /local/ds/xp20
/dev/md/ds/dsk/x21   200G   135G    63G    69%    /local/ds/xp21
/dev/md/ds/dsk/x22   200G   148G    50G    75%    /local/ds/xp22
/dev/md/ds/dsk/x23   200G   128G    70G    65%    /local/ds/xp23
/dev/md/ds/dsk/x24   200G   126G    72G    64%    /local/ds/xp24
/dev/md/ds/dsk/x25   200G   136G    62G    69%    /local/ds/xp25
/dev/md/ds/dsk/x26   200G   129G    69G    66%    /local/ds/xp26
/dev/md/ds/dsk/x27   200G   130G    68G    66%    /local/ds/xp27


xxx@[EMAIL PROTECTED]
  cat myFile
11     621 2008/03/21 12:44 xp20            256000 user/foo/INBOX
806   41722 2008/03/21 13:26 xp21            256000 user/bar/INBOX
2391  115428 2008/03/21 13:26 xp22            256000 user/moo/INBOX
2452  122771 2008/03/21 12:38 xp23            256000 user/123/INBOX
638   65484 2008/03/21 12:56 xp23            256000 user/345/INBOX
139    4892 2008/03/21 12:44 xp24            256000 user/789/INBOX
398   13403 2008/03/19 14:05 xp24            256000 user/1234/INBOX
392   32448 2008/03/21 14:14 xp25            256000 user/5678/INBOX




xxx@[EMAIL PROTECTED]
 awk '{print FILENAME,$FNR,$0}' myFile df_out
myFile 11     621 2008/03/21 12:44 xp20            256000 user/foo/
INBOX 11     621 2008/03/21 12:44 xp20            256000 user/foo/
INBOX
myFile 806   41722 2008/03/21 13:26 xp21            256000 user/bar/
INBOX 806   41722 2008/03/21 13:26 xp21            256000 user/bar/
INBOX
myFile 2391  115428 2008/03/21 13:26 xp22            256000 user/moo/
INBOX 2391  115428 2008/03/21 13:26 xp22            256000 user/moo/
INBOX
myFile 2452  122771 2008/03/21 12:38 xp23            256000 user/123/
INBOX 2452  122771 2008/03/21 12:38 xp23            256000 user/123/
INBOX
myFile 638   65484 2008/03/21 12:56 xp23            256000 user/345/
INBOX 638   65484 2008/03/21 12:56 xp23            256000 user/345/
INBOX
myFile 139    4892 2008/03/21 12:44 xp24            256000 user/789/
INBOX 139    4892 2008/03/21 12:44 xp24            256000 user/789/
INBOX
myFile 398   13403 2008/03/19 14:05 xp24            256000 user/1234/
INBOX 398   13403 2008/03/19 14:05 xp24            256000 user/1234/
INBOX
myFile 392   32448 2008/03/21 14:14 xp25            256000 user/5678/
INBOX  392   32448 2008/03/21 14:14 xp25            256000 user/5678/
INBOX
myFile
df_out /dev/md/ds/dsk/x20   200G   129G    69G    66%    /local/ds/
xp20 /dev/md/ds/dsk/x20   200G   129G    69G    66%    /local/ds/xp20
df_out /dev/md/ds/dsk/x21   200G   135G    63G    69%    /local/ds/
xp21 /dev/md/ds/dsk/x21   200G   135G    63G    69%    /local/ds/xp21
df_out /dev/md/ds/dsk/x22   200G   148G    50G    75%    /local/ds/
xp22 /dev/md/ds/dsk/x22   200G   148G    50G    75%    /local/ds/xp22
df_out /dev/md/ds/dsk/x23   200G   128G    70G    65%    /local/ds/
xp23 /dev/md/ds/dsk/x23   200G   128G    70G    65%    /local/ds/xp23
df_out /dev/md/ds/dsk/x24   200G   126G    72G    64%    /local/ds/
xp24 /dev/md/ds/dsk/x24   200G   126G    72G    64%    /local/ds/xp24
df_out /dev/md/ds/dsk/x25   200G   136G    62G    69%    /local/ds/
xp25 /dev/md/ds/dsk/x25   200G   136G    62G    69%    /local/ds/xp25
df_out /dev/md/ds/dsk/x26   200G   129G    69G    66%    /local/ds/
xp26 /dev/md/ds/dsk/x26   200G   129G    69G    66%    /local/ds/xp26
df_out /dev/md/ds/dsk/x27   200G   130G    68G    66%    /local/ds/
xp27  /dev/md/ds/dsk/x27   200G   130G    68G    66%    /local/ds/xp27

also:

xxx@[EMAIL PROTECTED]
 more tst.awk
BEGIN {
printf "%-15s%12s%10s%10s%10s%10s\n", "File System", "bytes", "used",
"avail", "capacity", "accounts"
print
"-------------------------------------------------------------------"
}

NR==FNR{ accts["/local/ds/"$5]++; next }
/dsk/ { printf "%-15s%12s%10s%10s%10s%10s\n", $6, $2, $3, $4, $5,
accts[$6]+0 }

Thanks,
sg




 26 Posts in Topic:
matching column variables from two awks!
spacegoose <spacegoose  2008-03-20 21:36:28 
Re: matching column variables from two awks!
Ed Morton <morton@[EMA  2008-03-21 00:04:37 
Re: matching column variables from two awks!
spacegoose <spacegoose  2008-03-21 07:15:57 
Re: matching column variables from two awks!
Ed Morton <morton@[EMA  2008-03-21 09:40:47 
Re: matching column variables from two awks!
spacegoose <spacegoose  2008-03-21 09:33:56 
Re: matching column variables from two awks!
Ed Morton <morton@[EMA  2008-03-21 14:59:28 
Re: matching column variables from two awks!
spacegoose <spacegoose  2008-03-21 13:51:43 
Re: matching column variables from two awks!
Ed Morton <morton@[EMA  2008-03-21 16:16:40 
Re: matching column variables from two awks!
spacegoose <spacegoose  2008-03-21 14:00:13 
Re: matching column variables from two awks!
spacegoose <spacegoose  2008-03-21 15:03:17 
Re: matching column variables from two awks!
spacegoose <spacegoose  2008-03-21 16:09:17 
Re: matching column variables from two awks!
Ed Morton <morton@[EMA  2008-03-21 18:32:47 
Re: matching column variables from two awks!
spacegoose <spacegoose  2008-03-21 22:00:21 
Re: matching column variables from two awks!
Ed Morton <morton@[EMA  2008-03-22 07:37:33 
Re: matching column variables from two awks!
spacegoose <spacegoose  2008-03-22 07:37:12 
Re: matching column variables from two awks!
Ed Morton <morton@[EMA  2008-03-22 18:16:25 
Re: matching column variables from two awks!
gazelle@[EMAIL PROTECTED]  2008-03-22 23:23:43 
Re: matching column variables from two awks!
Ed Morton <morton@[EMA  2008-03-22 19:44:09 
Re: matching column variables from two awks!
spacegoose <spacegoose  2008-03-22 22:13:30 
Re: matching column variables from two awks!
Ed Morton <morton@[EMA  2008-03-23 00:41:29 
Re: matching column variables from two awks!
"Rajan" <svr  2008-03-23 17:04:58 
Re: matching column variables from two awks!
Ed Morton <morton@[EMA  2008-03-23 16:50:45 
Re: matching column variables from two awks!
gazelle@[EMAIL PROTECTED]  2008-03-23 22:19:40 
Re: matching column variables from two awks!
"Rajan" <svr  2008-03-23 20:58:50 
Re: matching column variables from two awks!
spacegoose <spacegoose  2008-03-24 08:55:09 
Re: matching column variables from two awks!
Ed Morton <morton@[EMA  2008-03-26 08:13:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 6:34:35 CDT 2008.