0
I made my regex and it works perfectly on my regex making tool. But when I try to use my regex in my command line it doesn't work, or at least it seems I cannot use that.
my regex is:
.*\[(GET|POST|OPTIONS|PUT|DELETE)\].*
it matches the call method no matter where it is I want it to be displayed in a simple file containing all calls.
i tried many commands, one of which is:
cat myfile.txt | awk /'\[(GET|POST|OPTIONS|PUT|DELETE)\]/ {print $1}'
but it returns me the first column, although the matching group 1 is the method.
could anyone help me please?
I can provide an example if needed.
examples:
two possible inputs:
32.45.53.01, 32.32.32.543, 21.32.54.675, 21.32.54.779 161.21.34.56 [10/Mar/2020:13:04:14 +0100] [HTTP/1.1] [GET] [-://yahoo.com/webapp/wcs/stores/servlet/libero/home] 302 - EL=[22ms, -] WAS=[mediaworld_b2c:3213] - WAS=[-] - - [spam]
10.40.23.483 10.8.21.321 [10/Mar/2020:15:18:06 +0100] [HTTP/1.1] [GET] [-://google-preprod.test.com/sda/v1/ticrcv/TSY-JKidsahjsdaAO-A-JYVS5gGFxZ8PY8J-GRs0g-GOB2C] 200 108 EL=[17ms, -] WAS=[-] - -
and the output in both case has to be just:
GET