How can I quickly find the first line of a file that matches a regex?
Posted
by lamcro
on Stack Overflow
See other posts from Stack Overflow
or by lamcro
Published on 2008-12-13T14:30:36Z
Indexed on
2010/04/01
17:13 UTC
Read the original article
Hit count: 301
I want to search for a line in a file, using regex, inside a Perl script.
Assuming it is in a system with grep installed, is it better to:
- call the external
grepthrough anopen()command open()the file directly and use awhileloop and anif ($line =~ m/regex/)?
© Stack Overflow or respective owner