I have several conditions for what I want to print (skip hello that is included in part I would like to print, print from \k{f} to \l{k}, from \word{g} to \word2{g}, print row starting \hello2 and print the part between \b and \bf - there is a problem: in \bf} is } that should not to be printed):
awk '
/\\hello/{
next
}
/\\k\{f\}|\\word\{g\}|\\b/{
found=1
}
found;
/\\l\{f\}|\\word2\{g\}|\\bf/{
found=""
}
/\\hello2/
' file.txt
I would like to add condition for \bf that it should be alone in the row. How to do that please?
file.txt:
text
text
\hello2
456
565
\word{g}
s
\hello
\word2{g}
\k{f}
fdsfd
fgs
\l{f}
text
\b
7
\hello
\bf}
text
Output now:
\word{g}
s
\word2{g}
\k{f}
fdsfd
fgs
\l{f}
\b
7
\bf}
The desired output:
\word{g}
s
\word2{g}
\k{f}
fdsfd
fgs
\l{f}
\b
7
\bf
This question is related to: this question
Add a condition to replace \bf} with \bf