Ruby One-Liner: Figure out what awk column to use

Handy to identify how awk will interpret ‘{print $whatever}’

ruby -e ‘`head /var/adm/messages -n 1`.split(” “).each_with_index do |x,v| print “#{v+1} #{x}\n” end’

Leave a Reply

XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>