06-01-2011
This grep is native to Perl. Just follow the link I gave for it, it's a native Perl built-in, it doesn't rely on any external tools.
This User Gave Thanks to pludi For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm using perl to do a grep of each line in a vendor file and find its occurrences in a specific directory. Any values found is saved in @dir.
.....(file opened, etc.)
....
while ($line=<FILE>){
@dir = `grep $line * `;
}
It's the specific usage of the system grep that I'm having... (7 Replies)
Discussion started by: gavineq
7 Replies
2. Shell Programming and Scripting
OK here's the situation:
I have got these lines which I have got to parse.
If the line contains a particular string and any element from a previously defined array I need to take that particular line and do some further processing.
if ((grep(/$_/,$1)) && (grep($pattern,@myarr)))
{
#Do... (2 Replies)
Discussion started by: King Nothing
2 Replies
3. Shell Programming and Scripting
$ grep edge test_1 |sort|uniq >result.txt
$more result.txt
edge-a-pas01.com 10.12.10.11
edge-b-pas02.com 10.12.10.12
edge-c-pas03.com 10.12.10.50
edge-d-pas03.com 10.12.10.10
how do we execute the above grep command using perl?
Thanks in advance. (3 Replies)
Discussion started by: sureshcisco
3 Replies
4. Shell Programming and Scripting
Hello
I want to grep a line from a file saved in some directory.
Can anyone please correct the code below:
#!/usr/bin/perl -w
$file = "/home/output.txt"
$grep_line = "closing zip for topic";
`grep $grep_line* $file`; (1 Reply)
Discussion started by: sureshcisco
1 Replies
5. Shell Programming and Scripting
Hi All i have this script that uses glob to look in /var/log/messages.*
my @messagefiles = glob "/var/log/messages.*";
and the code that uses it is this
grep { /NVRM: Xid/ } @messages)
but this spits out this
/var/log/messages-20111030:Oct 25 13:43:04 brent kernel: NVRM:... (10 Replies)
Discussion started by: ab52
10 Replies
6. Shell Programming and Scripting
Hi,
Can anybody let me know how this grep will work.
The input and output is not known.
Also can you give me the details of any link where i can find clearly about grep
Thanks in advance (1 Reply)
Discussion started by: irudayaraj
1 Replies
7. Shell Programming and Scripting
Hi,
Can anyone tell me how this grep works?
Type of input is not known
Thanks in advance (2 Replies)
Discussion started by: irudayaraj
2 Replies
8. Shell Programming and Scripting
Hi,
i want to create perl script to telnet and print the output. :
This is the script that i have so far :
#!/usr/bin/perl
use lib '/usr/lib/perl5/5.14';
use Telnet ();
$target = "192.168.5.1";
$user = "root";
$passwd = "admin123";
print... (2 Replies)
Discussion started by: justbow
2 Replies
9. Emergency UNIX and Linux Support
Hi,
i have input like this :
SS-ID VLAN MAC TIME IP RSSI MODE UAPSD BW GI WMOS DHCP IDENTITY
----- ---- --- ---- -- ---- ---- ----- -- -- ---- ---- --------
1-1 0 C4:46:19:75:C1:55 23m 192.168.5.253 ... (5 Replies)
Discussion started by: justbow
5 Replies
10. Shell Programming and Scripting
hello Everyone i am a newbie.
i have a file which contains the following
E:\gtmproj\script\i486_nt\obj\check_geomtools.exe: o:\portsrc\spg\system_1\i486_nt\advapps\TK-2\objmt\winclockmtq.lib
E:\gtmproj\script\i486_nt\obj\check_geomtools.exe:... (12 Replies)
Discussion started by: Rashid Khan
12 Replies
GREP(1) General Commands Manual GREP(1)
NAME
grep - search a file for lines containing a given pattern
SYNOPSIS
grep [-elnsv] pattern [file] ...
OPTIONS
-e -e pattern is the same as pattern
-c Print a count of lines matched
-i Ignore case
-l Print file names, no lines
-n Print line numbers
-s Status only, no printed output
-v Select lines that do not match
EXAMPLES
grep mouse file # Find lines in file containing mouse
grep [0-9] file # Print lines containing a digit
DESCRIPTION
Grep searches one or more files (by default, stdin) and selects out all the lines that match the pattern. All the regular expressions
accepted by ed and mined are allowed. In addition, + can be used instead of * to mean 1 or more occurrences, ? can be used to mean 0 or 1
occurrences, and | can be used between two regular expressions to mean either one of them. Parentheses can be used for grouping. If a
match is found, exit status 0 is returned. If no match is found, exit status 1 is returned. If an error is detected, exit status 2 is
returned.
SEE ALSO
cgrep(1), fgrep(1), sed(1), awk(9).
GREP(1)