When I type a command at the command line it supplies one result and the exact same command in a script
egrep '^01|^02|^03|^04' file > fileout
count = 29353
same count in the script yields a count of 23492
is there any reason this could be happening. (1 Reply)
ls -ltr | grep string
How can I use regular expressions to filter the results provided even more. I am using the above command as a reference. (1 Reply)
On our one HP-UX 11i box, we have some very long paths defined. When I want to check on our user processes running, the resulting paths are chopped off. /xyz/abc/123/......./server/b is really a process running in the ..../server/bin directory. Is this a terminal problem or buffer length... (1 Reply)
Hi all,
Can someone help me with the following problem.
I am executing the following command:
(search for occurences of 'error' in files that match cl-*.log expression)
> grep -cw -i --max-count=1 'error' cl-*.log
this command outputs:
cl-apache.log:1
cl-apache_error.log:1... (3 Replies)
Hi
I am having a 'grep' headache
Here is the contents of my file:
(PBZ,CP,(((ME,PBZ,BtM),ON),((ME,((PBZ,DG),(CW9,PG11))),CW9,TS2,RT1)))
I would like to count out how many times 'PBZ' occurs and then place that number in the line above
3... (8 Replies)
Hi,
I am currently reading a tar file and searching for a particular word using grep e.g. Plane. At the moment, if a sentence is found with the word "Plane" the sentence itself is piped to another file.
Here is the code i am using;
for jar in 'cat jar_file.tar'; do
tar -tvf... (3 Replies)
I am using grep to match a pattern, but the output is strange.
$ grep -r -o "pattern" *
Gives me:
Binary file foo1 matches
Binary file foo2 matches
Binary file foo3 matches
To find the lines before/after, I then have to use the following on each file:
$ strings foo1 | grep -A1 -B1... (0 Replies)
Good afternoon,
I have just messed up and deleted some directories on my UNIX machine.
I would now want to know which packages are impacted by this. Therefore I have a look in the file "/var/sadm/install/contents" (which contains the filenames/directory names for each installation package). After... (2 Replies)
Hi,
i have a file hello.log which as several line that look like the below
2015-12-07 09:46:56 0:339 120.111.12.12 POST /helloWorld
2015-12-07 09:46:57 0:439 122.111.12.12 POST /helloWorld
....
when i grep expecting to see results like the below.
... (6 Replies)
Hi
I wanted to know if there is an option in grep command to show the number of results (not the number of lines of findings).
Thanks (14 Replies)
Discussion started by: abdossamad2003
14 Replies
LEARN ABOUT DEBIAN
mail::mbox::messageparser::grep
Mail::Mbox::MessageParser::Grep(3pm) User Contributed Perl Documentation Mail::Mbox::MessageParser::Grep(3pm)NAME
Mail::Mbox::MessageParser::Grep - A GNU grep-based mbox folder reader
SYNOPSIS
#!/usr/bin/perl
use Mail::Mbox::MessageParser;
my $filename = 'mail/saved-mail';
my $filehandle = new FileHandle($filename);
my $folder_reader =
new Mail::Mbox::MessageParser( {
'file_name' => $filename,
'file_handle' => $filehandle,
'enable_grep' => 1,
} );
die $folder_reader unless ref $folder_reader;
# Any newlines or such before the start of the first email
my $prologue = $folder_reader->prologue;
print $prologue;
# This is the main loop. It's executed once for each email
while(!$folder_reader->end_of_file());
{
my $email = $folder_reader->read_next_email();
print $email;
}
DESCRIPTION
This module implements a GNU grep-based mbox folder reader. It can only be used when GNU grep is installed on the system. Users must not
instantiate this class directly--use Mail::Mbox::MessageParser instead. The base MessageParser module will automatically manage the use of
grep and non-grep implementations.
METHODS AND FUNCTIONS
The following methods and functions are specific to the Mail::Mbox::MessageParser::Grep package. For additional inherited ones, see the
Mail::Mbox::MessageParser documentation.
$ref = new( { 'file_name' => <mailbox file name>, 'file_handle' => <mailbox file handle> });
<file_name> - The full filename of the mailbox
<file_handle> - An opened file handle for the mailbox
The constructor for the class takes two parameters. The file_name parameter is the filename of the mailbox. The file_handle argument is
the opened file handle to the mailbox.
Returns a reference to a Mail::Mbox::MessageParser object, or a string describing the error.
BUGS
No known bugs.
Contact david@coppit.org for bug reports and suggestions.
AUTHOR
David Coppit <david@coppit.org>.
LICENSE
This software is distributed under the terms of the GPL. See the file "LICENSE" for more information.
HISTORY
This code was originally part of the grepmail distribution. See http://grepmail.sf.net/ for previous versions of grepmail which included
early versions of this code.
SEE ALSO
Mail::Mbox::MessageParser
perl v5.10.1 2009-08-09 Mail::Mbox::MessageParser::Grep(3pm)