Sponsored Content
Top Forums Shell Programming and Scripting perl regular expressions and field search Post 302230663 by quine on Saturday 30th of August 2008 04:01:05 PM
Old 08-30-2008
If you want to SPLIT a line into FIELDS as you say you do in bash, then look up perl's split() built in subroutine... On the other hand, if what you really want is to test the characters from positionX to positionY, then use perl's unpack() function. Once you split out your field by delimiter or position, then you can test it using regular expressions to see if it is the string you want...

I'm not going to do ALL the work for you Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl regular expressions...

I am writing script that will act like the 'comm' utility. My problem is when trying to read whether the user has entered -123 or -1 or -1...etc. I currently have: if(m/??/g){ print "Good.\n"; } So, this should check for all... (1 Reply)
Discussion started by: DrRo183
1 Replies

2. UNIX for Dummies Questions & Answers

Regular Expressions HELP - PERL

Hello, $line=USING (FILE '/TEST1/FILENAME'5000) I want to reterive the value between ' and ) which is 5000 here. i have tried out the following expressions ... Type 1 : $Var1=`sed -e 's/.*\' //' -e 's\).*$/' $line`; Type 2 : $Var1=`echo $line | awk -F"\'" '{print $2}' | awk -F"\\)"... (1 Reply)
Discussion started by: maxmave
1 Replies

3. Shell Programming and Scripting

Regular Expressions HELP - PERL

Hello, $line=USING (FILE '/TEST1/FILENAME'5000) I want to reterive the value between ' and ) which is 5000 here. i have tried out the following expressions ... Type 1 : $Var1=`sed -e 's/.*\' //' -e 's\).*$/' $line`; Type 2 : $Var1=`echo $line | awk -F"\'" '{print $2}' | awk -F"\\)"... (3 Replies)
Discussion started by: maxmave
3 Replies

4. Shell Programming and Scripting

Search Replace with regular expressions

Hello I have this regular expression: </book>(?:\n)<collection>(.*)</collectioninfo> And I have this peace of text on a FILE <book bookid="3" title="the title 3" remaining = "50" price="100"> <reader readerid="1"><!]></reader> <reader readerid="2"><!]></reader> <reader... (1 Reply)
Discussion started by: dirdamalah
1 Replies

5. Shell Programming and Scripting

Regular expressions - Perl

Hello everybody, I am trying to connect from hp-ux to win 2003 using perl's Net::Telnet module. Seeing the examples in couple of web sites, I saw I have to declare a Prompt => Can somebody please tell me what my regular expression should be? The prompt after I log in is: ... login:... (1 Reply)
Discussion started by: whatever
1 Replies

6. Shell Programming and Scripting

regular expressions using perl script

i have a set of regular expressions. The words in the regular expression should be used to replace the i/p with hyphens '---'. i need perl script to evaluate these regular expression. the words in the regexes when found in the i/p file should be replaced with hyphens '---'. the set of regular... (3 Replies)
Discussion started by: Sgiri1
3 Replies

7. Shell Programming and Scripting

Perl regular expressions don't like the @ ("at") sign.

Take a look at this code: #!/usr/bin/perl use 5.008; $_ = "somename@address.com"; if(/\@\w+\.com/) { print "\n\nmight be an email address\n\n"; } else { print "\n\nnot an email address\n\n"; } Shouldn't the /\@\w+\.com/ evaluate as true? I've also tried: ... (3 Replies)
Discussion started by: mrwatkin
3 Replies

8. Programming

Which language is best suited for regular expressions perl,python.ruby ?

Hello all, i am in a bit of dilema here. i dont know any thing about perl or python. only know a little bit of awk. now unable to take a decission as to which language to go for. my requirement is building a testing framework.suite which will execute ssytem comands remotely on unix... (2 Replies)
Discussion started by: achak01
2 Replies

9. Shell Programming and Scripting

Perl - Regular Expressions - Match complete word only

Hi Team, I have two strings like: xxx|yyy|Arizona Cardinals| Tell Cardinals | Cardinals bbb|Bell Earn, Jr | Bell Earn | Jayhawks | hawks I have a lookup file which has a set of strings. These need to be removed from above two strings Lookup file Contents: Bell Earn, Jr hawks... (2 Replies)
Discussion started by: forums123456
2 Replies

10. Shell Programming and Scripting

PERL Regular Expressions

im trying to extract some tags between and in a file..for eg..the file format is I want the and extracted from the file i.e the tags which is present b/w and I have the regex for extracting the tags from the whole file but how to specify my search within the and... (1 Reply)
Discussion started by: rajkrishna89
1 Replies
BBDB-AREACODE-SPLIT.PL(1)				      General Commands Manual					 BBDB-AREACODE-SPLIT.PL(1)

NAME
bbdb-areacode-split - Looks for phone numbers in your .bbdb SYNOPSIS
bbdb-areacode-split <old-code> <new-code> <exchanges-file> [bbdb] DESCRIPTION
Looks for phone numbers in your .bbdb with a particular area code and one of a set of exchanges and changes the area code. The old and new area codes are specified on the command line, as is the location of a file that contains the exchanges that are being changed. (The format of that file is very loose. Every three digit sequence will be used.) This manual page was written for the Debian distribution because the original program does not have a manual page. Instead, it has docu- mentation in the GNU Info format; see below. SEE ALSO
bbdb-cid(1), bbdb-unlazy-lock(1). bbdb-srv(1). The bbdb is fully documented by The insidious Big Brother Database for mail and news, available via the Infonode bbdb AUTHOR
This manual page was written by Joerg Jaspert (JJ) <joerg@goliathbbs.dnsalias.net>, for the Debian GNU/Linux system (but may be used by others). March 31, 2002 BBDB-AREACODE-SPLIT.PL(1)
All times are GMT -4. The time now is 10:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy