T
Thomas Luedeke
--EXCITEBOUNDARY_000__796dc6f1a754043d7228e5e7c2665116
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Quick (and slightly embarassing) newbie question for the Ruby experts. I'm trying to learn Ruby, and move away from antediluvian UNIX scripting.How do I make a sequence of pattern matching lines in a file, then extract a particular field from the line? For example, in UNIX talk if I were interested in finding all lines with a particular match pattern "test", and printing the fourth field, I'd do a grep plus awk command such as:grep "test" file_name | awk ' { print $4 } ' >> output_fileHowever, in my Ruby books, I don't see any discussion about the function equivalent of printing a field of the type "$4" (i.e. fourth field). I can get the lines out of the search file, but I'm not quite sure how to determine fields.Thanks.TPL
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
--EXCITEBOUNDARY_000__796dc6f1a754043d7228e5e7c2665116--
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Quick (and slightly embarassing) newbie question for the Ruby experts. I'm trying to learn Ruby, and move away from antediluvian UNIX scripting.How do I make a sequence of pattern matching lines in a file, then extract a particular field from the line? For example, in UNIX talk if I were interested in finding all lines with a particular match pattern "test", and printing the fourth field, I'd do a grep plus awk command such as:grep "test" file_name | awk ' { print $4 } ' >> output_fileHowever, in my Ruby books, I don't see any discussion about the function equivalent of printing a field of the type "$4" (i.e. fourth field). I can get the lines out of the search file, but I'm not quite sure how to determine fields.Thanks.TPL
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
--EXCITEBOUNDARY_000__796dc6f1a754043d7228e5e7c2665116--