Mailinglist Archive: opensuse-factory (883 mails)

< Previous Next >
grep, cut, and all that (Re: [opensuse-factory] Status: Beta)
Jan Engelhardt <jengelh@xxxxxxx> writes:

On Tuesday 2012-05-29 09:48, Stephan Kulow wrote:

I don't know why kiwi's initrd calls an external tool for it either :)

haveKByte=`cat /proc/meminfo | grep MemFree | cut -f2 -d:|
cut -f1 -dk`


cat has been obsolete for these kind of tasks, you can just use

grep MemFree /proc/meminfo

...

A grep and 2 cut commands? That's asking for awk (assuming that awk is
available in your enviroment:

awk '/^MemFree:/ {print $2}' /proc/meminfo

or

awk '/^MemFree:/ {print $2; exit}' /proc/meminfo

--
Karl Eichwalder SUSE LINUX Products GmbH
R&D / Documentation Maxfeldstraße 5
90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe, e-mail: opensuse-factory+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-factory+owner@xxxxxxxxxxxx

< Previous Next >