awk '/DoLabelQuery\(self\)/||/QName\[[[[:digit:]][[[:digit:]]]/||/QName\[[[[:digit:]]]/ || /;BUTTON =/ || /endMethod/ || /endmethod/ || /add\(/ || /;CODE = /' HELLO.fsl > x.txt
I know it has to be made into a file and run using awk -f
. I just can't seem to get the syntax right. The example above works in Linux in the terminal.
It may look complicated but all I'm looking for is 5-6 examples of text where if found leads to that line being written out to x.txt
. The QName
name element is just looking for QName[##]
or QName[#]
.
Best Answer
When I tried to run your command at first I got the error:
which makes it seem that all the parts of the
awk
script are being parsed as separate words and many of them are then being processed as though they are commands after||
. This is because, as this SO question shows single quotes aren't really quotes in Windows cmd shell, as they are in (most?) linux shells. cmd uses only double quotes, which fortunately works fine for this command it seems, so the solution here is to use:though I would expect putting the commands into a file and using it that way should work as well.