Home » Open Source » Programming Interfaces » Exact search string match
Exact search string match [message #423844] Mon, 28 September 2009 10:33 Go to next message
shoaib123
Messages: 118
Registered: December 2007
Location: Chicago
Senior Member
Hi,

I am newbie in Perl.This might be a simpler question for most of you, but i would appreciate if you answer it.

I need to search and grep only those lines from the file, which start with particular string...

Let's say,if i have 2-3 lines like this in any file...
#hello: what is 
#hello: who is
hello :  hi


i need to select only the line which start with "hello" not with "#"..

I did search and tried the some reg exp with grep and other finctions but no luck yet...

Thanks in advace..
Re: Exact search string match [message #423850 is a reply to message #423844] Mon, 28 September 2009 11:05 Go to previous message
shoaib123
Messages: 118
Registered: December 2007
Location: Chicago
Senior Member
I found the answer finally.. Just posting for future vistors..


 grep(/^hello/,$string)

Previous Topic: ORA-22835 error
Next Topic: vb6 and Oracle 8.16 / 11g different results
Goto Forum:
  


Current Time: Thu Mar 28 03:15:12 CDT 2024