buggrep - Bugs: bug #14630, feature request: grep -p[separator]

 
 

You are not allowed to post comments on this tracker with your current authentification level.

bug #14630: feature request: grep -p[separator]

Submitted by:  None
Submitted on:  Sat 24 Sep 2005 12:03:47 PM UTC  
Votes:  11  
 
Category: NoneSeverity: 1 - Wish
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

(Jump to the original submission Jump to the original submission)

Wed 16 Feb 2011 03:33:02 PM UTC, comment #7:

It is very helpful to use grep -p on AIX while processing big logfiles. As a lot of Linux systems used as server, it could be very helpful to implement this feature into GNU grep.

Ubul Vendro <sh4d0w>
Tue 09 May 2006 06:37:46 AM UTC, comment #6:

I have an incomplete implementation of a more general feature that defines "universes" or records, and search within them. This feature is borrowed from University of Waterloo's context grep (cgrep).

New feature additions are currently on hold while we iron out pending bug fixes. Once we move on to new future, I'll try to submit a patch to introduce universes.

Tony Abou-Assaleh <taa>
Project Administrator
Mon 08 May 2006 08:04:28 PM UTC, comment #5:

I think this is a pretty signifigant feature and would be a GoodThing(tm) to add.

I think the ifconfig example was just an example, not a practical use. I use the -p on AIX to hork out individual records when a record is multiple lines.

It may be a nonstandard option, but it's quick, easy and useful.

There is no comparison between a single, simple flag and using AWK, or writing a PERL one-liner, or whatever.

I know this is very very nontrivial to add, but I highly recommend it because it's the right thing to do on a number of fronts, including GNU being replacements for closed-source tools, usability by the non-UNIX elite/experts, etc.

Josh Davis <xaminmo>
Mon 17 Oct 2005 12:38:54 AM UTC, comment #4:

grep -p also features in TRU64

Anonymous
Sun 25 Sep 2005 02:28:49 PM UTC, comment #3:

> the -p option available on AIX, Solaris, HP-UX, and possibly
> other platforms.


HP-UX grep does not support the -p option.

Bob Proulx <rwp>
Project Member
Sat 24 Sep 2005 08:29:43 PM UTC, comment #2:

After verification, while AIX does support this option, neither do Solaris 10 nor HP-UX 11i (at least according to their online documentation). Also,

/sbin/ifconfig eth0

is a much simpler way to achieve this specific task.

Charles Levert <charles_levert>
Sat 24 Sep 2005 04:33:39 PM UTC, comment #1:

"Shocked" sounds somewhat quite strong a word. It's not so surprising that a non-standard extension which can readily be replicated with common existing tools is not implemented in GNU grep.

/sbin/ifconfig -a | awk 'BEGIN {RS = "\n\n"} /127/'
/sbin/ifconfig -a | perl -ne 'BEGIN {$/ = "\n\n"} print if /127/'

Even with its four superfluous spaces characters, the awk solution is even shorter than, say

/sbin/ifconfig -a | grep --input-record-separator='\n\n' 127

given that awk and perl also support an output record separator, which someone would invariably ask to be supported as well with its own distinctive option, sooner or later.

It's easy enough to define a shell function or minimal awk/perl script around either of the two basic one-line templates above.

Do we really need to add this to GNU grep?

Charles Levert <charles_levert>
Sat 24 Sep 2005 12:03:47 PM UTC, original submission:

I was shocked to find that GNU grep doesn't support the -p option available on AIX, Solaris, HP-UX, and possibly other platforms. With this option grep displays the paragraph containing each matching line. Paragraphs are delimited by a separator, which follows the same formatting as a search pattern. The default separator is a blank line.

While using grep on other platforms, I've found this option to be quite handy. On my GNU/Linux laptop, I immediately reached for it like this:

# ifconfig | grep -p eth0

But it wasn't there. Could this be added?

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by sh4d0w (Posted a comment)
  • -unavailable- added by sh4d0w (Voted in favor of this item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 11 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 16 Feb 2011 03:28:41 PM UTCsh4d0wCarbon-Copy-=>Added sh4d0w
    Mon 08 May 2006 08:04:28 PM UTCxaminmoCarbon-Copy-=>Added -unavailable-
      Carbon-Copy-=>Added xaminmo
    Sat 24 Sep 2005 04:33:39 PM UTCcharles_levertSeverity3 - Normal=>1 - Wish

    Back to the top


    Powered by Savane 3.1-cleanup