Unix Technical Forum

off-topic - list files on linux

This is a discussion on off-topic - list files on linux within the pgsql Admins forums, part of the PostgreSQL category; --> Hi people, just a rapid question related to linux How can I get the files in a directory, but ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 08:19 AM
A.Burbello
 
Posts: n/a
Default off-topic - list files on linux

Hi people,

just a rapid question related to linux
How can I get the files in a directory, but not the
last file updated/created?

I could get the last file updated with:
ls -t1p | grep -v / | grep -v backup | head -1

How can I get the inverse list, other files without
the last??

Thank you in advance.


Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento!
http://br.mail.yahoo.com/


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 08:19 AM
Achilleas Mantzios
 
Posts: n/a
Default Re: off-topic - list files on linux

Óôéò Friday 28 March 2008 14:39:53 ï/ç A.Burbello Ýãñáøå:
> ls -t1p *| grep -v / | grep -v backup | head -1


maybe:
ls -t1p | grep -v / | grep -v backup | grep -v `ls -t1p | grep -v / | grep -v backup | head -1`

--
Achilleas Mantzios

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 08:19 AM
Achilleas Mantzios
 
Posts: n/a
Default Re: off-topic - list files on linux

Óôéò Friday 28 March 2008 14:39:53 ï/ç A.Burbello Ýãñáøå:
> ls -t1p *| grep -v / | grep -v backup | head -1


maybe:
ls -t1p | grep -v / | grep -v backup | grep -v `ls -t1p | grep -v / | grep -v backup | head -1`

--
Achilleas Mantzios

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-10-2008, 08:19 AM
salman
 
Posts: n/a
Default Re: off-topic - list files on linux



Achilleas Mantzios wrote:
> Óôéò Friday 28 March 2008 14:39:53 ï/ç A.Burbello Ýãñáøå:
>> ls -t1p | grep -v / | grep -v backup | head -1

>
> maybe:
> ls -t1p | grep -v / | grep -v backup | grep -v `ls -t1p | grep -v / | grep -v backup | head -1`
>


1) the -e flag for grep can be used to group strings so you don't have
to pipe multiple times (eg: grep -i -e bleh -e bleh2 -e bleh3 -ve backup)

2) wouldn't find be easier to use? find . -maxdepth 1 -type -f -print

-salman

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-10-2008, 08:19 AM
hubert depesz lubaczewski
 
Posts: n/a
Default Re: off-topic - list files on linux

On Fri, Mar 28, 2008 at 09:39:53AM -0300, A.Burbello wrote:
> How can I get the files in a directory, but not the
> last file updated/created?
> I could get the last file updated with:
> ls -t1p | grep -v / | grep -v backup | head -1
> How can I get the inverse list, other files without
> the last??


ls -t1p | grep -v / | grep -v backup | tac | tail -n +2

depesz

--
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA. here's my CV!"
http://www.depesz.com/ - blog dla ciebie (i moje CV)

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-10-2008, 08:20 AM
Achilleas Mantzios
 
Posts: n/a
Default Re: off-topic - list files on linux

Óôéò Friday 28 March 2008 19:38:02 ï/ç salman Ýãñáøå:
>
> Achilleas Mantzios wrote:
> > Óôéò Friday 28 March 2008 14:39:53 ï/ç A.Burbello Ýãñáøå:
> >> ls -t1p | grep -v / | grep -v backup | head -1

> >
> > maybe:
> > ls -t1p | grep -v / | grep -v backup | grep -v `ls -t1p | grep -v / | grep -v backup | head -1`
> >

>
> 1) the -e flag for grep can be used to group strings so you don't have
> to pipe multiple times (eg: grep -i -e bleh -e bleh2 -e bleh3 -ve backup)
>
> 2) wouldn't find be easier to use? find . -maxdepth 1 -type -f -print
>

I tried to give an example, using *only* primitives that already existed inthe original question.
> -salman
>




--
Achilleas Mantzios

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:01 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com