Re: keeping the two latest files on a folder

2009-10-19 Thread Javier Barroso
Hi, On Mon, Oct 19, 2009 at 6:43 PM, Israel Garcia wrote: > On 10/18/09, Javier Barroso wrote: >> Hi, >> >> On Sun, Oct 18, 2009 at 5:32 AM, Israel Garcia wrote: >>> Hi Guys, that's me again.. I'm stuck again with sed to make a change >>> to a file.. sorry if it sounds off-topic.. but I need yo

Re: keeping the two latest files on a folder

2009-10-19 Thread Israel Garcia
On 10/18/09, Javier Barroso wrote: > Hi, > > On Sun, Oct 18, 2009 at 5:32 AM, Israel Garcia wrote: >> Hi Guys, that's me again.. I'm stuck again with sed to make a change >> to a file.. sorry if it sounds off-topic.. but I need your help :-). >> >> I've just want to change on a file this line: >>

Re: keeping the two latest files on a folder

2009-10-19 Thread Andrew Sackville-West
On Sun, Oct 18, 2009 at 08:09:21PM +0200, Javier Barroso wrote: [...] > > I've just want to change on a file this line: > > > > vif = [ 'ip=167,112,134.223,mac=00:16:3E:FD:58:B8'] > > > > to: > > > > vif = > > ['ip=167,112,134.223,mac=00:16:3E:FD:58:B8,vifname=veth216','ip=10.1.1.1,mac=00:16:3E:FD

Re: keeping the two latest files on a folder

2009-10-18 Thread Javier Barroso
Hi, On Sun, Oct 18, 2009 at 5:32 AM, Israel Garcia wrote: > Hi Guys, that's me again.. I'm stuck again with sed to make a change > to a file.. sorry if it sounds off-topic.. but I need your help :-). > > I've just want to change on a file this line: > > vif = [ 'ip=167,112,134.223,mac=00:16:3E:FD

Re: keeping the two latest files on a folder

2009-10-17 Thread Israel Garcia
Hi Guys, that's me again.. I'm stuck again with sed to make a change to a file.. sorry if it sounds off-topic.. but I need your help :-). I've just want to change on a file this line: vif = [ 'ip=167,112,134.223,mac=00:16:3E:FD:58:B8'] to: vif = ['ip=167,112,134.223,mac=00:16:3E:FD:58:B8,vifna

Re: keeping the two latest files on a folder

2009-10-14 Thread Carl Johnson
Thomas Dickey writes: > On Thu, 15 Oct 2009, Matthew Smith wrote: > >> Quoth Boyd Stephen Smith Jr. at 14/10/09 23:12... >>> Your font has betrayed you. The single-column-mode option is "-1" >>> (dash-one), your messages says you tried the option "-l" >>> (dash-ell) which requested a >>> detail

Re: keeping the two latest files on a folder

2009-10-14 Thread Thomas Dickey
On Thu, 15 Oct 2009, Matthew Smith wrote: Quoth Boyd Stephen Smith Jr. at 14/10/09 23:12... Your font has betrayed you. The single-column-mode option is "-1" (dash-one), your messages says you tried the option "-l" (dash-ell) which requested a detailed (long) listing. Aha! Sure looked lik

Re: keeping the two latest files on a folder

2009-10-14 Thread Matthew Smith
Quoth Boyd Stephen Smith Jr. at 14/10/09 23:12... Your font has betrayed you. The single-column-mode option is "-1" (dash-one), your messages says you tried the option "-l" (dash-ell) which requested a detailed (long) listing. Aha! Sure looked like a lower-case L. Think I need to bump up th

Re: keeping the two latest files on a folder

2009-10-14 Thread Israel Garcia
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 wrote: > On Wed, Oct 14, 2009 at 04:43:04PM +1030, Matthew Smith wrote: >> Quoth Håkon Alstadheim at 14/10/09 16:37... >>> Du

Re: keeping the two latest files on a folder

2009-10-14 Thread Tzafrir Cohen
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 corr

Re: keeping the two latest files on a folder

2009-10-14 Thread Christopher Judd
On Tuesday 13 October 2009, Jeff D wrote: > On Tue, 13 Oct 2009, Israel Garcia wrote: > > Hi List, > > > > It's a simple question but difficult to me :-). > > > > How can I delete all files on a folder / but keeping only the > > two latest (newest) files? > > how about something like this to

Re: keeping the two latest files on a folder

2009-10-14 Thread Boyd Stephen Smith Jr.
In <4ad5706d.4070...@smiffytech.com>, Matthew Smith wrote: >Quoth Håkon Alstadheim at 2009-10-14 16:52... >> Seems to work here. Standard behaviour for 'ls' is to use >> single-column-mode when output is not to a tty. Your ls command may be >> aliased to something, or it might be a different versio

Re: keeping the two latest files on a folder

2009-10-13 Thread Roland Müller
Hello, > Andrew Sackville-West skrev: > > On Tue, Oct 13, 2009 at 06:46:31PM -0400, Chris Jones wrote: > > > >> On Tue, Oct 13, 2009 at 03:35:19PM EDT, Håkon Alstadheim wrote: > >> > >>> Israel Garcia skrev: > >>> > Hi List, > > It's a simple question but difficult t

Re: keeping the two latest files on a folder

2009-10-13 Thread Matthew Smith
Quoth Håkon Alstadheim at 2009-10-14 16:52... > Seems to work here. Standard behaviour for 'ls' is to use > single-column-mode when output is not to a tty. Your ls command may be > aliased to something, or it might be a different version from mine. Try > the manual page. Try with the '-1' option

Re: keeping the two latest files on a folder

2009-10-13 Thread Håkon Alstadheim
Matthew Smith skrev: 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 t

Re: keeping the two latest files on a folder

2009-10-13 Thread Matthew Smith
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 int

Re: keeping the two latest files on a folder

2009-10-13 Thread Håkon Alstadheim
Andrew Sackville-West skrev: On Tue, Oct 13, 2009 at 06:46:31PM -0400, Chris Jones wrote: On Tue, Oct 13, 2009 at 03:35:19PM EDT, Håkon Alstadheim wrote: Israel Garcia skrev: Hi List, It's a simple question but difficult to me :-). How can I delete all files on a folder /

Re: keeping the two latest files on a folder

2009-10-13 Thread Siggy Brentrup
On Tue, Oct 13, 2009 at 14:24 -0500, Israel Garcia wrote: > Hi List, > > It's a simple question but difficult to me :-). > > How can I delete all files on a folder / but keeping only the two > latest (newest) files? Try the following script: -- snip -- #!/bin/sh -e # Removes all but the 2

Re: keeping the two latest files on a folder

2009-10-13 Thread Andrew Sackville-West
On Tue, Oct 13, 2009 at 06:46:31PM -0400, Chris Jones wrote: > On Tue, Oct 13, 2009 at 03:35:19PM EDT, Håkon Alstadheim wrote: > > Israel Garcia skrev: > >> Hi List, > >> > >> It's a simple question but difficult to me :-). > >> > >> How can I delete all files on a folder / but keeping only th

Re: keeping the two latest files on a folder

2009-10-13 Thread Chris Jones
On Tue, Oct 13, 2009 at 03:35:19PM EDT, Håkon Alstadheim wrote: > Israel Garcia skrev: >> Hi List, >> >> It's a simple question but difficult to me :-). >> >> How can I delete all files on a folder / but keeping only the two >> latest (newest) files? >> >> > untested, run it with 'echo' in

Re: keeping the two latest files on a folder

2009-10-13 Thread Håkon Alstadheim
Israel Garcia skrev: Hi List, It's a simple question but difficult to me :-). How can I delete all files on a folder / but keeping only the two latest (newest) files? untested, run it with 'echo' in front first to test: rm $(ls -rt | sed '1,2d') -- To UNSUBSCRIBE, email to debian-u

Re: keeping the two latest files on a folder

2009-10-13 Thread Israel Garcia
On 10/13/09, Jeff D wrote: > On Tue, 13 Oct 2009, Israel Garcia wrote: > >> Hi List, >> >> It's a simple question but difficult to me :-). >> >> How can I delete all files on a folder / but keeping only the two >> latest (newest) files? >> > how about something like this to start: > for file

Re: keeping the two latest files on a folder

2009-10-13 Thread Israel Garcia
On 10/13/09, Jeff D wrote: > On Tue, 13 Oct 2009, Israel Garcia wrote: > >> Hi List, >> >> It's a simple question but difficult to me :-). >> >> How can I delete all files on a folder / but keeping only the two >> latest (newest) files? >> > how about something like this to start: > for file

Re: keeping the two latest files on a folder

2009-10-13 Thread Israel Garcia
On 10/13/09, Michael Erickson wrote: > On Tue, Oct 13, 2009 at 12:24 PM, Israel Garcia wrote: >> Hi List, >> >> It's a simple question but difficult to me :-). >> >> How can I delete all files on a folder / but keeping only the two >> latest (newest) files? > > Here's one way, (warning: thi

Re: keeping the two latest files on a folder

2009-10-13 Thread Michael Erickson
On Tue, Oct 13, 2009 at 12:24 PM, Israel Garcia wrote: > Hi List, > > It's a simple  question but difficult to me :-). > > How can I delete all files on a folder / but keeping only the two > latest (newest)  files? Here's one way, (warning: this will probably break painfully on filenames with

Re: keeping the two latest files on a folder

2009-10-13 Thread Jeff D
On Tue, 13 Oct 2009, Israel Garcia wrote: > Hi List, > > It's a simple question but difficult to me :-). > > How can I delete all files on a folder / but keeping only the two > latest (newest) files? > how about something like this to start: for file in $(ls -tA | egrep -v "$(ls -tA |head -n

keeping the two latest files on a folder

2009-10-13 Thread Israel Garcia
Hi List, It's a simple question but difficult to me :-). How can I delete all files on a folder / but keeping only the two latest (newest) files? -- Regards; Israel Garcia -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contac