Re: Find a string and print next 10 lines



On 2012-06-13, contracer wrote:
Hi,
I´m looking for an awk command to find a string in a file and print
next 10 lines.

grep -A 10 STRING FILE ...


--
Chris F.A. Johnson, author <http://shell.cfajohnson.com/>
===================================================================
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)

.



Relevant Pages

  • Re: reading file into array
    ... grep "car" $| while read line; ... echo $ ... Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ...
    (comp.unix.shell)
  • Re: grep with 2 variables
    ... On 2010-09-17, contracer wrote: ... How use this grep? ... Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ...
    (comp.unix.shell)
  • Re: Find a string and print next 10 lines
    ... grep -A 10 STRING FILE ... ... Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ...
    (comp.unix.shell)
  • Re: find a file containing two words in different lines
    ... Use grep -l to greate a list containing one of the words, ... Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ...
    (comp.unix.shell)
  • Emulation of gnu greps -N option
    ... How to emulate gnu grep's -N option with awk, ... listing N lines before and after the matched lines? ... grep -3 string file ... This will be useful where gnu grep is not installed. ...
    (comp.lang.awk)