Chad Fowler [mailto:chad / chadfowler.com] answered: > > Hi. Here's a very awk-like way to do it: > > cat foo.dat |ruby -ane 'puts $F[0].to_i * $F[1].to_i' > > -a autosplits and creates $F, which is an array of the fields on each > line. > > -n creates a loop for each line of input. > > -e executes the next arg as a ruby program. > > One interesting note if you're coming from awk is that the record > separator (specified by -F on the command line of both Ruby and awk) > can accept a regular expression. So (for a silly example), you could > have a file like this: > > this123123124is524234234a987234872test > > and executing > ruby -F[0-9]+ -ane 'puts $F[3]' > ...would output "test" cool tip. thank you very much. > Chad kin regards -botp