1835002 Members
2496 Online
110073 Solutions
New Discussion

Re: perl parsing

 
SOLVED
Go to solution
andi_1
Frequent Advisor

perl parsing

Hi guys,

In some cases I will have to read the file and I will
encounter a line similar to the below.
"Test,Test (test,ex1)"

I will need to determine whether the line contains
..test.com. What is the best way to determine it?

Thanks!
2 REPLIES 2
H.Merijn Brand (procura
Honored Contributor
Solution

Re: perl parsing


local $/ = undef;
open FIL, "< file";
=~ m/\btest\.com\b/s or exit;
Enjoy, Have FUN! H.Merijn
Peter Kloetgen
Esteemed Contributor

Re: perl parsing

Hi Andi,

you don't need perl for this, use simply the grep-command:

grep 'test.com' input_file

or

grep -v 'test.com' input_file

to get all lines which don't contain the string test.com

You could also pipe the output of these commands to your perl-script.

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping