Sorry, many more have responded. Thanks to all. use nawk (new awk) rather than awk (very old awk), and install gawk (GNU awk) match can be replaced by /Memory/, so: awk '/Memory/{print substr($0, 8)}' /var/adm/messages ------Original Message------ From: Daniel Lee <daniel_lee@asia.com> To: sunmanagers@sunmanagers.org 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 <daniel_lee@asia.com> To: "'sunmanagers@sunmanagers.org'" <sunmanagers@sunmanagers.org> Sent: May 22, 2001 7:32:20 PM GMT Subject: awk question Folks, 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. HP-UX: awk 'match($0,"Memory"){print substr ($0,8)}' /var/adm/syslog/syslog.log returns... 16:41:32 hostname vmunix: Memory Information: Linux: awk 'match($0,"Memory"){print substr ($0,8)}' /var/log/syslog returns... 09:29:51 hostname kernel: Memory: 516724k/524288k available (1048k kernel code, 412k reserved, 5616k data, 64k init, 0k bigmem) Solaris: awk 'match($0,"Memory"){print substr ($0,8)}' /var/adm/messages returns... 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. Thanks, Daniel ______________________________________________ FREE Personalized Email at Mail.com Sign up at http://www.mail.com/?sr=signupReceived 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