[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: keeping the two latest files on a folder



Hey guys, thanks for your answers... :-)

talking about sed, here is a great tutorial...
http://www.grymoire.com/Unix/Sed.html

regards,
Israel.

On 10/14/09, Tzafrir Cohen <tzafrir@cohens.org.il> wrote:
> On Wed, Oct 14, 2009 at 04:43:04PM +1030, Matthew Smith wrote:
>> Quoth Håkon Alstadheim at 14/10/09 16:37...
>>> Due to all the positive feed-back, I actually tested the "ls -rt"-bit,
>>> and sure enough, the 'r' makes ls list the newest files _last_, so you
>>> DON'T want 'r'. This makes the correct command:
>>>
>>> rm $(ls -t | sed '1,2d')
>>
>> I thought this looked like an interesting recipe, so I tried it.  (With
>> echo, I hasten to add.)
>>
>> I get a listing of every file (and directory) in the directory, but all
>> on one line.
>>
>> All the sed seems to do is to convert the multiple spaces used to format
>> ls -t into single spaces.
>
> try:  ls $PARAMETERS | cat
>
> 'ls' defaults to a single-column format when the output is a pipe.
>
> --
> Tzafrir Cohen         | tzafrir@jabber.org | VIM is
> http://tzafrir.org.il |                    | a Mutt's
> tzafrir@cohens.org.il |                    |  best
> ICQ# 16849754         |                    | friend
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact
> listmaster@lists.debian.org
>
>


-- 
Regards;
Israel Garcia


Reply to: