are you still invoking grep command from your perl script? if yes, use the m operator of Perl instead.
here's a plan that could work for you:
1. get a list of all *.txt files, using opendir and readdir
2. open multiple threads
3. in each thread, open a single file from the list and search the string using m operator, append the results in the output file
but this approach would work only if i/o sub-system is fast in your system. otherwise cpu and memory would wait for io if disks are slower.
I am looking for help in processing of those options: '-n' or '-p'
I understand what they do and how to use them.
But, I would like to use them with more than one file (and without any shell-loop; loading the 'perl' once.)
I did try it and -n works on 2 files.
Question is:
- is it possible to... (6 Replies)
I am new to unix and I would like to search multiple log files to find earliest occurrence of a text.
Ex:
Say I have 10 logs file each ending with .log and I want to find the text “CustomeError” .
I want to find the which log file “CustomeError” comes first and lines which surround’s ... (4 Replies)
Hi All,
i have an output of command vmstat as below :
$ vmstat
System configuration: lcpu=4 mem=5376MB ent=1.00
kthr memory page faults cpu
----- ----------- ------------------------ ------------ -----------------------
r b avm fre re pi... (10 Replies)
I'm attempting to use grep in Perl with very little success.
What I would like to do in Perl is get the output of the following grep code:
grep -l 'pattern' *
This gives me a list of all the files in a directory that contain the pattern that was searched.
My attempts to do this in Perl... (4 Replies)
Hi again
I have figured out how to be able to sort through lines in a file with multiple words in any order and display them using this command:
cat file | grep -i $OPTION1 | grep -i $OPTION2 | grep -i $OPTION3 OPTION1 is 2008, OPTION2 is Mar, OPTION 3 is Tue
Result:
Tue Mar 25... (4 Replies)
Hi,
I have code like:
Output it is comming as:
Rels: WM2
Rels: WG2
Rels: 5
- pre/prods.pl
Rels: 6
Rels: 7
Rels: 8
Rels: 10
Rels: Int
But i want only "Rels: 5" pattern Just above "- pre/prods.pl".
By... (7 Replies)
Hello People,
Need some assistance/guidance.
OUTLINE:
Two files (File1 and File2)
File1 has some ids such as
009463_3922_1827
897654_8764_5432
File2 has things along the lines of:
Query= 009463_3922_1827 length=252
(252 letters)
More stufff here
... (5 Replies)
Hello,
I'm trying to create a program in perl called myfind.pl;
To use the program:
(at the command line)$ program.pl keyword filename
note: the keyword is any word or regular expression
and it should display the result just like when you 'cat' the file name but with the keyword in... (2 Replies)
I know this must be really easy, but i can't get it to work
I've got a perl script, with a file.
I want to print an empty line, and the following doesn't seem to work:
print nameoffile "\n"
thanks for your help!! (3 Replies)
I am using a DEC ALPHA running Digital UNIX (formly DEC OSF/1) and ksh. I have a directory with hundreds of files that only share the extension .rpt. I would like to search that directory based on serial number and operation number and only files that meet both requirements to be printed out. I... (6 Replies)