Re: Pls help with Unix shell question
From: Chris F.A. Johnson (c.fa.johnson_at_rogers.com)
Date: 03/05/04
- Next message: Kevin Collins: "Re: lex / yacc grammar for ksh and/or POSIX sh"
- Previous message: Michael Tosch: "Re: Pls help with Unix shell question"
- In reply to: Michael Heiming: "Re: Pls help with Unix shell question"
- Next in thread: Michael Heiming: "Re: Pls help with Unix shell question"
- Reply: Michael Heiming: "Re: Pls help with Unix shell question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 5 Mar 2004 17:21:00 GMT
On Fri, 05 Mar 2004 at 15:49 GMT, Michael Heiming wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> wl <bli01@yahoo.com> wrote:
> [..]
>
>> I have a bunch of files, ending with ".data" in a Unix directory, which I
>> want to process in date order with a program. I recall doing
>> something similar in the old days. Does anyone have an example?
>
> for f in `ls -atr *.data`
This breaks is there are spaces in the file names. Use:
ls -atr *.data | while IFS= read -r f
Of course, this will not work if there are newlines in any of the
file names. But I would consider that a broken file system.
> do
><something with> $f
> done
>
> Hint:
> man ls
--
Chris F.A. Johnson http://cfaj.freeshell.org/shell
===================================================================
My code (if any) in this post is copyright 2004, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
- Next message: Kevin Collins: "Re: lex / yacc grammar for ksh and/or POSIX sh"
- Previous message: Michael Tosch: "Re: Pls help with Unix shell question"
- In reply to: Michael Heiming: "Re: Pls help with Unix shell question"
- Next in thread: Michael Heiming: "Re: Pls help with Unix shell question"
- Reply: Michael Heiming: "Re: Pls help with Unix shell question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|