dwcronin
asked on
how to output lines of a text file surrounding a certain pattern
I have a bunch of Fortran files and they all have "common blocks" for their variables. What Unix command do I need to type
to print out the 10 (this is an arbitrary number) above and the 10 lnes (arbitrary) below where the word "DATAPOOL"
appears in all of my files? I'm looking for something like "grep ... | awk ... > MyVariableList.txt" but I don't remember unix very well.
to print out the 10 (this is an arbitrary number) above and the 10 lnes (arbitrary) below where the word "DATAPOOL"
appears in all of my files? I'm looking for something like "grep ... | awk ... > MyVariableList.txt" but I don't remember unix very well.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
grep -A 10 -B 10 DATAPOOL filename