emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#30242: closed (help)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#30242: closed (help)
Date: Wed, 24 Jan 2018 22:23:03 +0000

Your message dated Wed, 24 Jan 2018 16:22:32 -0600
with message-id <address@hidden>
and subject line Re: bug#30242: help
has caused the debbugs.gnu.org bug report #30242,
regarding help
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
30242: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=30242
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: help Date: Wed, 24 Jan 2018 20:51:49 +0000 (UTC)
Hi
i want to copy some data from a file by using of grep...
grep -n A HISTORY > out
but the desired information is not the line of A, and i need information located at the next line ( below line of A)

A  1   2   3

23   34  55

i mean i need the line 23 34 55.
would you mind to help me please?
many thanks

--- End Message ---
--- Begin Message --- Subject: Re: bug#30242: help Date: Wed, 24 Jan 2018 16:22:32 -0600 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2
tag 30242 notabug
thanks

On 01/24/2018 02:51 PM, Masoudi wrote:
> Hii want to copy some data from a file by using of grep...grep -n A HISTORY > 
> outbut the desired information is not the line of A, and i need information 
> located at the next line ( below line of A)
> A  1   2   3
> 23   34  55
> i mean i need the line 23 34 55.would you mind to help me please?many thanks

(Your email engine botched the formatting of your mail as rendered in
plain text; technical lists tend to frown on html mail as unnecessary
overhead and lousy rendering)

grep already supports this: use 'grep -A1 "$pattern"' to output a line
that matches and the line immediately following the match.  If you
further want ONLY the line after, you can do things like:

grep -n -A1 "$patt" | sed -n 's/^[1-9][0-9]*-//p'

which uses the decorate-act-undecorate paradigm (grep -n decorates
matches with 'line:' and followups with 'line-'; the sed then picks the
followups and removes the decorations).

As -A is already documented as a grep option, I'm closing this as not a
bug in the database.  However, feel free to followup with further
questions on the topic.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]