1753872 Members
7404 Online
108809 Solutions
New Discussion юеВ

Re: ls command

 
SOLVED
Go to solution
augusto cossa
Frequent Advisor

ls command

Good Day all,

I have the below command:

# ls -latr | grep "Jun 30"

What I have to add to this command in order to remove his results?

Thanks,

A Cossa
3 REPLIES 3
Andreas Voss
Honored Contributor
Solution

Re: ls command

Hi,

do this:

ls -latr | awk '/Jun 30/{system("rm " $NF)}'

I've put the grep expression into awk to you have to pipe only once (no grep needed)

Greetings

Andrew
augusto cossa
Frequent Advisor

Re: ls command

Andreas,

Thanks a lot. The command works well.

A Cossa
Andreas Voss
Honored Contributor

Re: ls command

Hi Augusto,

thank you for the points but haven't you looked at your question
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xfe5b7e990647d4118fee0090279cd0f9,00.html ?
Was the answer not sufficient for you ?

Greetings

Andrew