You're missing the delimiter (tells awk how to separate a line of text
into fields).
In this case, using white space would be best, so you would probably
want to modify the variable so that it is assigned like this:
stat=`grep Swap\: /proc/meminfo | awk -F\ '{print $4}'`
-Rob
> Hi
>
> I am trying to adapt a script I have found to run MRTG
> to cut a long story short I need to figure out how awk
> figures out deciphers which is the right field to choose?
>
> ie which would be the print for Free MEM & Swap
>
> Many thanks
>
> Mike
> ______________________________________________________
>
> stat=`grep Swap: /proc/meminfo | awk '{print $4}'`
>
> total: used: free: shared: buffers: cached:
> Mem: 80277504 75956224 4321280 0 2551808 41312256
> Swap: 309616640 37437440 272179200
> MemTotal: 78396 kB
> MemFree: 4220 kB
> MemShared: 0 kB
> Buffers: 2492 kB
> Cached: 40344 kB
> Active: 39624 kB
> Inact_dirty: 1740 kB
> Inact_clean: 1472 kB
> Inact_target: 1948 kB
> HighTotal: 0 kB
> HighFree: 0 kB
> LowTotal: 78396 kB
> LowFree: 4220 kB
> SwapTotal: 302360 kB
> SwapFree: 265800 kB
>
>
> This mail was processed by Mail essentials for Exchange/SMTP,
> the email security & management gateway. Mail essentials adds
> content checking, email encryption, anti spam, anti virus,
> attachment compression, personalised auto responders, archiving
> and more to your Microsoft Exchange Server or SMTP mail server.
> For more information visit http://www.mailessentials.com
>
>
>
> _______________________________________________
> Redhat-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-list
>
--
-Rob
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list