From: Brian Candler Date: 2012-09-07T04:19:49+09:00 Subject: Re: awk equivalent in ruby Ferdous ara wrote in post #1074829: > HI > how to use awk equivalent in ruby > > in bash i can use , awk to get the value 1 > RFC1155-SMI::enterprises.2636.3.40.1.4.1.2.1.3.1.13.118.99.112.45.48.47.48.46.51.50.55.54.56 > = INTEGER: 1 As a one-liner, awk-style? echo "Foo.1.2.3 = INTEGER: 1" | ruby -ane 'puts $F[3]' In a ruby script? str = "Foo.1.2.3 = INTEGER: 1" a, b, c, d = str.split puts d This is assuming the '1' you want is the one at the end of the line. -- Posted via http://www.ruby-forum.com/.