Sponsored Content
Full Discussion: grep -v equivalent in perl
Top Forums Shell Programming and Scripting grep -v equivalent in perl Post 302523471 by birei on Thursday 19th of May 2011 02:43:53 AM
Old 05-19-2011
Hi,

Try next command:
Code:
$ perl -e '@a = <>; print +(grep { ! /^(?:\s*)$|(?i:visitor)/ } @a)' infile

Regards,
Birei
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

export equivalent command in PERL

Hi I need an equivalent command in PERL for the following. export LC_ALL=C; I hope this is the command. Please confirm this and correct me if i am wrong $ENV{LC_ALL}="C"; Thanks and Regards Ammu (1 Reply)
Discussion started by: ammu
1 Replies

2. Shell Programming and Scripting

perl equivalent to grep -c

Guess the subject lines says it all. What is the perl equivalent to grep -c -c, --count Suppress normal output; instead print a count of match- ing lines for each input file. With the -v, --invert- match option (see below), count non-matching lines. ... (6 Replies)
Discussion started by: popeye
6 Replies

3. Shell Programming and Scripting

strtok equivalent in perl

Hi All, Is their any equivalent for strtok (in c) to use in perl script. Thanks in advance. JS (1 Reply)
Discussion started by: jisha
1 Replies

4. Shell Programming and Scripting

need perl equivalent

Dear All, Good day, can any of you help me in the following problem: I need to find the perl equivalent for the following commandline grep characters |awk '{print \$2}'Expecting your reply and thanks in advance. Warm regards Fredrick. (4 Replies)
Discussion started by: Fredrick
4 Replies

5. Shell Programming and Scripting

GAWK/GREP Equivalent

What is GAWK equivalent to greps -B 5 -A 5? zgrep -i "^oct 20" /var/log/syslog*|grep -iB 5 -A 5 'postfix\/pickup /var/log/syslog.1.gz:Oct 20 01:55:01 elmo CROND: (mail) CMD (/usr/bin/python -S /usr/lib64/mailman/cron/gate_news) /var/log/syslog.1.gz:Oct 20 02:00:01 elmo CROND: (mail) CMD... (5 Replies)
Discussion started by: metallica1973
5 Replies

6. Shell Programming and Scripting

What is the equivalent of NR (awk) in perl?

Hello, I searched online; it seems that perl use $NR as NR in awk; however it does not work for me. For example, how to re-write the following awk using perl: awk '{ print NR}' inputfile---------- Post updated at 01:55 PM ---------- Previous update was at 12:49 PM ---------- I found... (2 Replies)
Discussion started by: littlewenwen
2 Replies

7. Shell Programming and Scripting

Perl equivalent substitution

hi Geeks, my input file contains data like => 53 - Deewana Kar Raha Hai.mp3 54 - Hale Dil.mp3 55 - Ishq Sufiyana.mp3 56 - Abhi Kuch Dino Se.mp3 57 - Pee Loon Hoto Ki Sargam.mp3 I had used sed command to remove the prefix from the file name like sed 's/^\ it gives me the perfect... (4 Replies)
Discussion started by: lohith.dutta
4 Replies

8. Shell Programming and Scripting

sed Equivalent for awk/grep

Any equivalent command using awk or grep? sed -n "/^$(date --date='10 minutes ago' '+%b %_d %H:%M')/,\$p" /abc.log (7 Replies)
Discussion started by: timmywong
7 Replies

9. Shell Programming and Scripting

Perl : Perl equivalent to the ksh | and ;

Ive been trying to move to Perl. It has been a struggle. My question is, is there a good resource that explains nesting statements. As an example. To change primary Factory CTS 1.9.0(46) P1 *Slot 1 CTS 1.10.2(42) P1 To primary *Slot 1 CTS 1.10.2(42) P1 ... (5 Replies)
Discussion started by: popeye
5 Replies

10. AIX

Need grep -v Equivalent for AIX

Need grep -v "Hello" equivalent for AIX (9 Replies)
Discussion started by: mohtashims
9 Replies
Data::Grove::Visitor(3) 				User Contributed Perl Documentation				   Data::Grove::Visitor(3)

NAME
Data::Grove::Visitor - add visitor/callback methods to Data::Grove objects SYNOPSIS
use Data::Grove::Visitor; @results = $object->accept ($visitor, ...); @results = $object->accept_name ($visitor, ...); @results = $object->children_accept ($visitor, ...); @results = $object->children_accept_name ($visitor, ...); DESCRIPTION
Data::Grove::Visitor adds visitor methods (callbacks) to Data::Grove objects. A ``visitor'' is a class (a package) you write that has methods (subs) corresponding to the objects in the classes being visited. You use the visitor methods by creating an instance of your vis- itor class, and then calling `"accept($my_visitor)"' on the top-most object you want to visit, that object will in turn call your visitor back with `"visit_OBJECT"', where OBJECT is the type of object. There are several forms of `"accept"'. Simply calling `"accept"' calls your package back using the object type of the object you are vis- iting. Calling `"accept_name"' on an element object calls you back with `"visit_name_NAME"' where NAME is the tag name of the element, on all other objects it's as if you called `"accept"'. All of the forms of `"accept"' return a concatenated list of the result of all `"visit"' methods. `"children_accept"' calls `"accept"' on each of the children of the element. This is generally used in element callbacks to recurse down into the element's children, you don't need to get the element's contents and call `"accept"' on each item. `"children_accept_name"' does the same but calling `"accept_name"' on each of the children. `"attr_accept"' calls `"accept"' on each of the objects in the named attribute. Refer to the documentation of the classes you are visiting (XML::Grove, etc.) for the type names (`"element"', `"document"', etc.) of the objects it implements. RESERVED NAMES
The hash keys `"Contents"' and `"Name"' are used to indicate objects with children (for `"children_accept"') and named objects (for `"accept_name"'). NOTES
These are random ideas that haven't been implemented yet: o Several objects fall into subclasses, or you may want to be able to subclass a visited object and still be able to tell the difference. In SGML::Grove I had used the package name in the callback (`"visit_SGML_Element"') instead of a generic name (`"visit_element"'). The idea here would be to try calling `"visit_PACKAGE"' with the most specific class first, then try superclasses, and lastly to try the generic. AUTHOR
Ken MacLeod, ken@bitsko.slc.ut.us SEE ALSO
perl(1), Data::Grove Extensible Markup Language (XML) <http://www.w3c.org/XML> perl v5.8.0 2000-02-22 Data::Grove::Visitor(3)
All times are GMT -4. The time now is 06:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy