...
I saw your one example on
exportdnsrr-report.txt how about the other files/formats?...
Depends on the delimiter and what exactly you want to match. The code assumes that:
(1) Your delimiter is a comma, and
(2) You want to match an entire token between delimiters i.e. this -
Code:
123,XYZ,abc,0.234
is a valid match for "abc", but this -
Code:
123,XYZ,param=abc,0.234
is not.
Since the delimiters for "exportOBJ-sark.txt" and "exportdnsrr-report.txt" are the same (comma), the code should work for both, assuming you want the match semantics like (2) above.
For the 3rd file - "ResourceRecText-ALL.txt", you'll have to split it as per the delimiter. And the rest of the logic remains the same.
for ResourceRecText-ALL.txt
(example of contents)
outputRR-sark.com.txt:ResourceRecText=whdgss1infz-qapri1.is.sark.com.
outputRR-sark.com.txt:ResourceRecText=n3mgss1infz-qasec1.is.sark.com.
I am looking to search only on what the name is after the =
so for the abve excerpt would be:
whdgss1infz-qapri1.is.sark.com.
String found where operator expected at -e line 2, near "{chomp; @x=split/,/; foreach $i(@x){if (defined $s{$i}) {print $_,""
(Might be a runaway multi-line "" string starting on line 1)
(Missing semicolon on previous line?)
String found where operator expected at -e line 2, at end of line
(Missing semicolon on previous line?)
syntax error at -e line 2, near "{chomp; @x=split/,/; foreach $i(@x){if (defined $s{$i}) {print $_,""
Can't find string terminator '"' anywhere before EOF at -e line 2.
I have existing pattern in the perl script as:
my $pattern = "^Line.*?:|^Errors*: |^SEVERE:.*?:|^Null pointer exception occurred";
and I wanted to include below keywords in my search pattern
"I/O exception" and "FileNotFoundException"the problem is when I include my pattern like
my... (5 Replies)
Hi,
I have a string like:
read_lib {$lib/a.lib $lib/b.lib $lib/c.lib ..... }
Now, I want to search existence of all these *.lib files in $lib directory.
Please suggest- how to do it.
Thanks
-rkg (2 Replies)
Hi,
I want the Perl script with versions 5.8.2 and 5.8.5 starting with
#!/usr/bin/perl
The Perl program should read the excel file or text file line by line and taking into an array and search in the UNIX directories for reference file of .jsp or .js or .xsl with path .The Object names... (2 Replies)
hi,
i have one file as t1.txt as below
hi
hello
welcome
i want perl script to search for the pattern "abcd" in the file.
if the pattern doesn't exist, i want to insert that pattern at the end of the same file t1.txt
my o/p should be
hi
hllo
welcome
abcd
thank you (3 Replies)
Good evening All,
I have a perl script to pull out all occurrences of a files beginning with xx and ending in .p. I will then loop through all 1K files in a directory. I can grep for xx*.p files but it gives me the entire line. I wish to output to a single colum with only the hits found. ... (3 Replies)
Dear all,
I am new to perl script and would need some help for my 1st script. I wrote a script to search sprintf(buf,"%s", sourcestring) and replace with snprintf(buf, sizeof(buf),"%s", sourcestring). As snprintf() requires an extra argument, so it is not a simple search-and-replace. I need to... (1 Reply)
I am using perl to perform a search and replace. It works at the command line, but not in the csh shell script
perl -pi -e 's@/Pattern@@g' $path/$file
I used the @ as my delimiter because the pattern contains "/" (3 Replies)
I wanted a perl script to be done for Password search & replace in two files.
For Example:
Example 1)--i am having a file such as
cat /opt/customer/Ariba/UAT/ariba/app/buyer/Server/config/Parameters.table
Example 2)--and i am having a other file in other location such as cat... (4 Replies)
i have to point out that i'm a avid shell script lover and i have next to zero interest in perl which is why i dont know the first thing about it. however, just need to do this one thing on it..
i need to do something in perl but dont know how. I have a list of email addresses in the following... (5 Replies)
Hello,
I have a requirement to search a directory, which contains any number of other directories for file names that contain special characters.
directory structure
DIR__
|__>DIR1
|__>DIR2__
|__>DIR2.1
|__>DIR2.2
|__>DIR3
..
... (8 Replies)