I have the following pattern of a string:
"METHOD URL VERSION"
example "GET /someurl/resource.html HTTP/1.1"
How can I get the url from this string with grep.
I did the following(assuming that string contains in f.txt)
cat f.txt | grep -P '[^(( )|(\")|(HTTP\/\d\.\d)|(GET)|(POST))]+' -o
but it gives me such an output
someurl
resource
html
How can I retrieve /someurl/resource.html ?
This should do it:
ok, if you have the pattern:
“somestring1withoutspaces somestring2withoutspaces somestring3withoutspaces” then both of these works: