GNU bug report logs -
#30242
help
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Wed, 24 Jan 2018 16:22:32 -0600
with message-id <613467d7-d329-5c0b-a500-e9cb501d9f1b <at> redhat.com>
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
help-debbugs <at> gnu.org.)
--
30242: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=30242
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
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
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
[Message part 6 (text/plain, inline)]
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
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 7 years and 202 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.