Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Show HN: Rb – Turns Ruby into a command line utility. Parent comment
-a autosplits each line by whitespace and puts each element into the array F (this was inspired by AWK).
-n loops through each line of the file, and -E executes the perl.
$. (NR in AWK) is the line number.
As others have noted, you can write the same thing in ruby on the command line already with `ruby -ane 'puts $F[1] if $.>1'`
(Notice the similarities?)
If you write one liners in AWK, Perl, or Ruby often the "odd" variables look more like useful shortcuts.
*edit You could also write the perl without any of the special variables, but it would be much more verbose, hence the special characters and flags.
There are no comments on this comment yet.
-a autosplits each line by whitespace and puts each element into the array F (this was inspired by AWK).
-n loops through each line of the file, and -E executes the perl.
$. (NR in AWK) is the line number.
As others have noted, you can write the same thing in ruby on the command line already with `ruby -ane 'puts $F[1] if $.>1'`
(Notice the similarities?)
If you write one liners in AWK, Perl, or Ruby often the "odd" variables look more like useful shortcuts.
*edit You could also write the perl without any of the special variables, but it would be much more verbose, hence the special characters and flags.