Re: input rm
- From: Ed Morton <morton@xxxxxxxxxxxxxx>
- Date: Wed, 01 Aug 2007 10:39:19 -0500
Daniel Rock wrote:
Patrick <patrick.moresi@xxxxxxxxx> wrote:
Hi,
how can i to give input to rm command ?
i would to delete all file of June. to get June file i write:
ls -al | grep Jul | awk '{ print $9 }'
What about filenames which have the string "Jul" somewhere in their name?
Right. He could use:
ls -al | awk '$6 ~ "Jul" { print $9 }'
if the month name is in the 6th field, and in a POSIX awk (i.e. one that
supports Regular Expession Intervals) to select everything from the 9th
field on (to accomodate file names with non-newline spaces) would be:
sub(/^[[:space:]]*([^[:space:]]*[[:space:]]*){8}/,"")
So, with GNU awk you'd use:
ls -al | gawk --re-interval '$6 ~ "Jul" {
sub(/^[[:space:]]*([^[:space:]]*[[:space:]]*){8}/,""); print }'
Regards,
Ed.
.
- Follow-Ups:
- Re: input rm
- From: Michael Tosch
- Re: input rm
- References:
- input rm
- From: Patrick
- Re: input rm
- From: Daniel Rock
- input rm
- Prev by Date: Re: input rm
- Next by Date: Re: input rm
- Previous by thread: Re: input rm
- Next by thread: Re: input rm
- Index(es):
Relevant Pages
|