From: Alain Helfenstein Date: 2009-01-12T22:21:18+09:00 Subject: Data stream variables Hi I want to print all lines wihtch contains the string "Open" from a bunch of 'xml' files. Additionally I want to print the filename and the line number of the match. The problem with the following snippet is, that the variable '$.' does not reset the line number at the beginning of a new file. That menas, the printed file numbers are not correct except for the first file of '*.xml' ruby -n -e 'puts ($FILENAME + " " + $..to_s + "" + $_) if /Open/' *.xml Does anybody have a idea, on how to print the correct line number? Thanks a lot for your answer, Alain. -- Posted via http://www.ruby-forum.com/.