From: William James Date: 2008-10-25T09:55:01+09:00 Subject: Re: help with regular expressions Vandana wrote: > Hi all, > > I'm fairly new to programming with regular expressions. I would like > some help with the > following. Consider the format given below as what I will receive in a > file. > > While reading from the file, Im interested only in reading those lines > that have the forward-slash' in > them (lines 9,10,12, 13). How can I do this in ruby? > > 1. ------------------------------- > 2. Version 2.05 bla bla > 3. bla bla > 4. bla > 5. > 6. ------------------------------ > 7. xx 0.0 4.5 6.7 > 8. xx (yy) 2.0 4.5 5.6 > 9. a/b/c/d () 6.0 2.0 3.4 > 10. a/b/c/d (yy) > 11. > 12. h/j/k/l/m 5.0 9.0 8.9 > 13. h/j/k/l/m () > 14. > 15. xx 0.0 0.0 0.0 > 16. yy 8.9 8.9 8.0 > 17. --------------------------------------- > > > Thank you for your time & help > Vandana Awk: awk "/\//" myfile Ruby: ruby -ne "print if /\//" myfile --