Date: Wed, 16 Jan 2002 07:53:28 -0800 (PST) From: ann kok <annkok2001@yahoo.com> To: Giorgos Keramidas <keramida@FreeBSD.org> Cc: Jan Grant <Jan.Grant@bristol.ac.uk>, questions <questions@FreeBSD.org> Subject: Re: crontab to backup mail in date format Message-ID: <20020116155328.17373.qmail@web20108.mail.yahoo.com> In-Reply-To: <20020116033309.GB25005@hades.hell.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
Dear Giorgos Thank you But I tried your command. but got the following problem Pls help again [root@mail /tmp]# touch mail.2001.01.12.tar.gz [root@mail /tmp]# touch mail.2001.01.13.tar.gz [root@mail /tmp]# touch mail.2001.01.14.tar.gz [root@mail /tmp]# touch mail.2001.01.15.tar.gz [root@mail /tmp]# touch mail.2001.01.16.tar.gz [root@mail /tmp]# ls -l mail* -rw-r--r-- 1 root root 0 Jan 16 11:45 mail.2001.01.12.tar.gz -rw-r--r-- 1 root root 0 Jan 16 11:45 mail.2001.01.13.tar.gz -rw-r--r-- 1 root root 0 Jan 16 11:45 mail.2001.01.14.tar.gz -rw-r--r-- 1 root root 0 Jan 16 11:45 mail.2001.01.15.tar.gz -rw-r--r-- 1 root root 0 Jan 16 11:45 mail.2001.01.16.tar.gz [root@mail /tmp]# ls -1 mail.*.tar.gz | sort -3 | sed -e '1,3d' sort: when using the old-style +POS and -POS key specifiers, the +POS specifier must come first Try `sort --help' for more information. --- Giorgos Keramidas <keramida@FreeBSD.org> wrote: > On 2002-01-16 05:08:22, Giorgos Keramidas wrote: > > > > Sort backup archives by date, and erase everything > that is older than > > 3 days. If you have files called: > > > > % ls -1 mail.* > > mail.2002.01.08.tar.gz > > mail.2002.01.09.tar.gz > > mail.2002.01.10.tar.gz > > mail.2002.01.11.tar.gz > > mail.2002.01.12.tar.gz > > > > and you want to erase all but the 3 last, you can > use commands like: > > > > % ls -1 mail.*.tar.gz | sort -3 | sed -e '1,3d' > > Of course that should read: sort -r > > Bleh, I should stop replying to mail after 03:00 am. > > -- > Giorgos Keramidas . . . . . . . . . > keramida@{ceid.upatras.gr,freebsd.org} > FreeBSD Documentation Project . . . > http://www.freebsd.org/docproj/ > FreeBSD: The power to serve . . . . http://www.freebsd.org/ __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020116155328.17373.qmail>