Computing.Net > Forums > Unix > Perl pattern matching

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Perl pattern matching

Reply to Message Icon

Name: Carlos Picardal
Date: May 3, 2004 at 12:43:50 Pacific
OS: AIX 5.0
CPU/Ram: ??
Comment:

I have a line of code that partialy works.
It does not work the way i want it! I do not want it to pick up any duplicate entries.

Say I have two entries called car and icar, I just want to pick up car.

search pattern:

if (m/Database name.^$pattern/i)


entries:

Database name = car
blah blah
blah blah
blah blah

Database name = icar
blah blah
blah blah
blah blah



Sponsored Link
Ads by Google

Response Number 1
Name: Dlonra
Date: May 3, 2004 at 14:32:36 Pacific
Reply:

http://www.tek-tips.com/gthreadminder.cfm/lev2/4/lev3/32/pid/219

since this is the UNIX forum:
grep "^patt" file|sort |uniq -u


0

Response Number 2
Name: FishMonger
Date: May 3, 2004 at 21:15:52 Pacific
Reply:

if (Database name = $pattern\b/i)


Dlonra, are you infering that Perl is not a part of UNIX? It's been on every UNIX system that I've used.


0

Response Number 3
Name: FishMonger
Date: May 3, 2004 at 21:18:17 Pacific
Reply:

Oops, I left out the leading / on the regex.


0

Response Number 4
Name: Dlonra
Date: May 4, 2004 at 05:48:05 Pacific
Reply:

Fishmonger,

PERL was not on the pre-1987 UNIX systems I used.
Neither was python nor php - C++ was "C with classes"
These each have their own forums.

If I was critiquing Dlonra's solution, I would note that he was attempting to sort a file while Kialos!!23 simply wanted to distinguish between similar patterns.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Perl pattern matching

Script to delete lines from a file www.computing.net/answers/unix/script-to-delete-lines-from-a-file/7408.html

String Replacement w/ Sed www.computing.net/answers/unix/string-replacement-w-sed/5429.html

Substituting on the line above the match www.computing.net/answers/unix/substituting-on-the-line-above-the-match/2931.html