Tricky egrep

Hi folks!

My first post here.

I'm working on a script that retrieves a range of files from a list depending on a range of time.
UPDATE:
I've seen it could be difficult to read all this thing, so I'll make a summarize it..

How come I do this and take a result..

grep "..\:.." lista.new | egrep 'Mar 10 ((1[4-9]|2[0-9]|3[0-4]):([5-5][4-9]|[4-5][0-9]))|Mar 11 (([0-1][0-4]:[0-5][0-4])|([0-1][0-3]:[0-5][0-9]))'
drwxr-x---   3 atxiph   was6gp        20480 Mar 11 11:11 PRUEBAS_SENTINESI
drwxr-x---   3 atxiph   was6gp        20480 Mar 10 23:51 PRUEBAS_SENTINESI
drwxr-x---   3 atxiph   was6gp        20480 Mar 10 18:51 PRUEBAS_SENTINESI

..and this does nothing?

grep "..\:.." lista.new | egrep '$comando'

knowing thet $comando is the same egrep..

echo $comando
Mar 10 ((1[4-9]|2[0-9]|3[0-4]):([5-5][4-9]|[4-5][0-9]))|Mar 11 (([0-1][0-4]:[0-5][0-4])|([0-1][0-3]:[0-5][0-9]))

Ideas?

[quote=kl0x;302503618]
Hi folks!

How come
.
.
.this does nothing?

grep "..\:.." lista.new | egrep '$comando'

knowing thet $comando is the same egrep..

Ideas?

No shell will look inside single quotes.  Try this:echo '$comando'

instead of

echo $comando

to see what egrep is seeing.

Hi!

Thank you for your reply. The thing is that the egrep doesn't work, the echo works fine (It's just to make sure that $comand is the correct string).

So egrep '$comand' won't work while egrep 'inside of $comand' will..

I'm not able to see it!:wall:

Your echo works "fine" because you have no single quotes. (Actually, it has mislead you.) Now go and try the alternate echo I gave you. The one with the single quotes. This is the echo that will show you what is happening.

I got you, I'll try to find how to do it, thx

---------- Post updated at 06:17 PM ---------- Previous update was at 06:13 PM ----------

Ok I got it like this:

grep "..\:.." lista.new | egrep "$comando"