Create a gist now

Instantly share code, notes, and snippets.

Your commandline is a perfectly good ruby IDE.
# ugh, have to learn awk
cat /tmp/foo.txt | awk '{print $2 " " $11}' | sort | uniq
# more prolix, but scales to complex scripts
cat /tmp/foo.txt | ruby -ne 'puts $_.split.values_at(1,10).join("\t")' | sort | uniq
cat /tmp/foo.txt | ruby -e 'bins = Hash.new{|h,k| h[k] = []} ; $stdin.readlines.map(&:split).each{|r| bins[r[1]] << r[10] } ; bins.each{|band,obs| puts [band, obs.count,obs.join(",")].join("\t") }'
QSO: 14000 CW 2011-03-19 1229 W1JQ 599 0001 UV5U 599 0041
QSO: 14000 CW 2011-03-19 1232 W1JQ 599 0002 SO2O 599 0043
QSO: 21000 CW 2011-03-19 1235 W1JQ 599 0003 RG3K 599 VR
QSO: 21000 CW 2011-03-19 1235 W1JQ 599 0004 UD3D 599 MO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment