On 12-Aug-2010, at 11:25, Michael Gersten wrote:
> 
>>> 
>>> eval `vm_stat | sed -n '/^Pages /{;s///;s/: */=/;s/\.$//;s/[- ]/_/g;p;}'`
>> 
>> Oh, that's clever!
> 
> Clever is understanding it :-).

With all the lines that begin with "Pages " (/^Pages /) do the following:
  0) do not echo the line (-n)
{
  1) nothing (;)
  2) replace "Pages " with nothing (s///)
  3) replace : and any number of spaces with an = (s/: */=/)
  4) remove the period at the end of the line (s/\.$//
  5) replace ever - or space with an underscore (s/[- ]/_/g)
  6) print the result (p)
}
end

-- 
"In order to avoid being called a flirt, she always yielded easily."
Charles, Count Talleyrand

_______________________________________________
MacOSX-talk mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/macosx-talk

Reply via email to