Created
April 8, 2011 16:49
-
-
Save mrflip/910255 to your computer and use it in GitHub Desktop.
Your commandline is a perfectly good ruby IDE.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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