Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Feb 2013 14:07:13 -0500
From:      Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
To:        tundra@tundraware.com
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: Fun Scripting Problem
Message-ID:  <44pq04f2xq.fsf@lowell-desk.lan>
In-Reply-To: <511BE12C.204@tundraware.com> (Tim Daneliuk's message of "Wed, 13 Feb 2013 12:53:32 -0600")
References:  <511BDB13.3060005@tundraware.com> <13CA24D6AB415D428143D44749F57D7201EA7EBB@ltcfiswmsgmb21> <511BE12C.204@tundraware.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Tim Daneliuk <tundra@tundraware.com> writes:

> On 02/13/2013 12:38 PM, Teske, Devin wrote:
>> (apologies for top-post)
>>
>> As tempted as I am, I think newsyslog(8) may be what you want.
>>
>> Missing information in your post is how you intend to timestamp the
>> files -- by filename? by content? If by-content, then is it a good
>> assumption that the data is one entry per-line? ... and if-so, is
>> the timestamp in that line? These are all questions that would be
>> needed to script what you're asking for (not that I'm volunteering
>> or anything like that).
>>
>
> The only way to determine the date of the file is by looking at its
> stat info.  There is nothing the file name or content that could
> be used to infer this.

Well, you can use stat to output the year, month, timestamp, and file
name in a fixed format for all of the files, sort them, and then cycle
through the list, deleting every file that has a year and month that are
the same as the following one in the list. The looping can be done with
sh "read" or with sed.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44pq04f2xq.fsf>