[EM]
asdf
asf
first
sec
[US]
endi
asdk
rt
[SKP]
123
ferf
dfg
ijglkp
jhgddd
I need help writing an expression that if the file is searched with US as keyword it should return
endi asdk rt
if SKP is searched it should return
123 ferf dfg ijglkp jhgddd
The first argument to the following script is the keyword (EM, US, SKP ... without brackets). The second argument is an optional filename. If provided, the file's contents are searched. If not provided, standard input is read.