Re: do it all with grep and ls or is there another option
- From: mmccaws2 <mmccaws@xxxxxxxxxxx>
- Date: Tue, 25 Mar 2008 17:41:31 -0700 (PDT)
On Mar 25, 5:22 pm, "Chris F.A. Johnson" <cfajohn...@xxxxxxxxx> wrote:
On 2008-03-26, mmccaws2 wrote:
Supposed a simple request
I'd like to search through a directory for all files having Feb in
them that begin with 'q1' then list those files out into a file with
most recent change last. and I need to know how many files.
I get so far
grep Feb q1* | cat -n
but this doesn't give me the most recent last.
ls -ltr q1* | cat -n
give most recent last and counts but it doesn't eliminate q1*s that
don't have 'Feb'
ls -ltr q1*Feb* | cat -n
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
Woops
thanks for your effort, but shame on me for not clarifying that the
Feb is not part of the filename. Feb should be found in a line within
each file name that begins with q1. In fact it'll probably be a date
like Feb 03, 2008, so I'll be looking for a string.
Mike
.
- Follow-Ups:
- Re: do it all with grep and ls or is there another option
- From: Janis Papanagnou
- Re: do it all with grep and ls or is there another option
- From: Barry Margolin
- Re: do it all with grep and ls or is there another option
- References:
- do it all with grep and ls or is there another option
- From: mmccaws2
- Re: do it all with grep and ls or is there another option
- From: Chris F.A. Johnson
- do it all with grep and ls or is there another option
- Prev by Date: Re: sort -m and locale?
- Next by Date: Re: sort -m and locale?
- Previous by thread: Re: do it all with grep and ls or is there another option
- Next by thread: Re: do it all with grep and ls or is there another option
- Index(es):
Relevant Pages
|