Summary: awk question II

From: Daniel Lee <>
Date: Tue May 22 2001 - 16:30:52 EDT
Sorry, many more have responded.  Thanks to all.

use nawk (new awk) rather than awk (very old awk), and install gawk (GNU

match can be replaced by /Memory/, so:
awk '/Memory/{print substr($0, 8)}' /var/adm/messages

------Original Message------
From: Daniel Lee <>
Sent: May 22, 2001 8:04:56 PM GMT
Subject: Summary: awk question

Thanks to the quick responses.


I have found that some things are broken in Solaris awk. I think the "match"
command is broken.

Try /usr/xpg4/bin/awk (The POSIX form).
Russ Poffenberger


Use /usr/xpg4/bin/awk on Solaris and your problems will disappear. ;-)

xpg4 contains the POSIX compliant versions of different programs on Solaris
and is preferable. Otherwise, you can download Gnu awk.

Sanjiv K. Bhatia

------Original Message------
From: Daniel Lee <>
To: "''" <>
Sent: May 22, 2001 7:32:20 PM GMT
Subject: awk question


This is off the topic.  I am not too familiar with awk.  I am trying gather
information regarding memory.  My awk statement works fine in HP-UX and
Linux.   However, I get error messages on Solaris.

awk 'match($0,"Memory"){print substr ($0,8)}' /var/adm/syslog/syslog.log
16:41:32 hostname vmunix: Memory Information:

awk 'match($0,"Memory"){print substr ($0,8)}' /var/log/syslog
09:29:51 hostname kernel: Memory: 516724k/524288k available (1048k kernel
code, 412k reserved, 5616k data, 64k init, 0k bigmem)

awk 'match($0,"Memory"){print substr ($0,8)}' /var/adm/messages
awk: syntax error near line 1
awk: bailing out near line 1

Can someone point out what is wrong or direct me where to look for help?  I
have been outlooking at the Sed & Awk book from O'Reilly.  My arguments
appear to be correct.


FREE Personalized Email at
Sign up at
Received on Tue May 22 21:30:52 2001

This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:24:55 EDT