Pergunta

So I have this really long file in which there are lines that are built like this:

`somecode [ somecode > somecode ] somecode > somecode > somecode` 

I have to search for a string of atleast 9 + or - characters between the brackets and the same thing that was matched between those brackets have to be found between the two '>' next to the brackets... So far I came up with this;

`cat file | egrep -n '*\[.*([-+]{9,}).*\].*(>).*\1.*(>).*' > out.txt`
Foi útil?

Solução

i guess from your regex,this is what you wanted to do

\[.*?([+-]{9,}).*?\].*?>.*?\1.*?>

if you want to get the full line use this

^.*?\[.*?([+-]{9,}).*?\].*?>.*?\1.*?>.*?$
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top