Issue
I am collecting some terms that I use in my job in a file:
terms.txt
term 1
here is the definition
definition continues
other
I will explain it here
blablabla
random word
etc
etc
blabla
I would like to grep for example "term" and pull the definition, the definition is in the next lines and start with a tab
I have tried to use grep -iA 3 termhere terms.txt but I would like to be more precise.
Solution
When a file is in paragraph mode I usually grep the paragraph in following way but by using Perl on a Linux system:
perl -n00 -e 'print if /term/' file.txt
Sample output is as follows:
[user@localhost ~]$ perl -n00 -e 'print if /term/' file.txt
term 1
here is the definition
definition continues
You can find more details about paragraph mode here - https://faculty.math.illinois.edu/~hildebr/computer/perltips.html
Answered By - Ashish Kumar Answer Checked By - Marilyn (WPSolving Volunteer)