I'm using ngrep
and grep
to extract some strings out of network traffic:
sudo ngrep -W byline | grep...
Now I want grep to search for a string and copy from first letter on until some different string appears. Strings are rtmp
and ..
For example:
"fwef-$*nVrtmp://Ggdggragravrv.com/lolwtf.mp5skill0rz%%&:/getr4kt..Glub"
should turn into:
"rtmp://Ggdggragravrv.com/lolwtf.mp5skill0rz%%&:/getr4kt"
Is this possible in any way?
You could try the below grep command which uses a positive lookahead based regex,
$ echo "fwef-$*nVrtmp://Ggdggragravrv.com/lolwtf.mp5skill0rz%%&:/getr4kt..Glub" | grep -oP 'rtmp.*?(?=\.\.)'
rtmp://Ggdggragravrv.com/lolwtf.mp5skill0rz%%&:/getr4kt