Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: 'groovy -ane' doesn't work, changed to 'groovy -a -ne'

...

Print processes owned by root:

No Format
ps aux|groovy -anea -ne "if(split[0] =~ 'root')println split[10..-1]"

...

Add the first and the penultimate column of a file:

No Format
groovy -apea -pe "split[0].toInteger()+split[-2].toInteger()" accounts.txt

...