Listing based on User and Date | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Listing based on User and Date

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-11-2012
muhnandap muhnandap is offline
Registered User
 
Join Date: Sep 2012
Last Activity: 3 October 2013, 3:24 AM EDT
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Listing based on User and Date

listing based on user.

I have files in some folder that come from many user

Code:
-rwxrwxr-x  1 ratih     pbank 4827112 Jun  8 08:37 S92TA-8.sgy
-rwxrwxr-x  1 ratih     pbank 4724568 Jun  8 08:37 S92TA-6.sgy
-rwxrwxr-x  1 ratih     pbank 4929656 Jun  8 08:37 S92TA-19.sgy
-rwxrwxr-x  1 ratih     pbank 9820216 Jun  8 08:37 S92TA-5.sgy
-rwxrwxr-x  1 ratih     pbank 4929656 Jun  8 08:37 S92TA-17.sgy
-rwxrwxr-x  1 ratih     pbank 6286392 Jun  8 08:37 S92TA-1.sgy
-rwxrwxr-x  1 ratih     pbank 4827112 Jun  8 08:37 S92TA-10.sgy
-rwxr-xr-x  1 aiprawira pbank 6106640 Jun 26 08:50 S92JA-002.sgy
-rw-r--r--  1 aiprawira pbank 1240080 Aug 30 10:11 S74JA-009.sgy
-rwxrwxr-x  1 aliyyus   pbank 1531440 Sep 12 09:29 S78JA-018_1.SGY
-rwxrwxr-x  1 aliyyus   pbank 2295360 Sep 12 09:29 S78JA-016.SGY
-rwxrwxr-x  1 aliyyus   pbank 2006768 Sep 12 09:29 S78JA-014_1.SGY
-rwxrwxr-x  1 aliyyus   pbank 1514464 Sep 12 09:29 S78JA-018_2.SGY

what command should I use to make listing for particular user and particular date
Sponsored Links
    #2  
Old 10-11-2012
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 27 July 2014, 5:28 AM EDT
Location: Switzerland - GE
Posts: 5,609
Thanks: 151
Thanked 387 Times in 364 Posts
simply using grep with ls, or more tricky using the command find...
With grep precedance is important (is it date or user most important?) but since you want 2 conditions hte importance is less except for performance... (like in sql language...)

You could try to see:

Code:
ls -l |grep <date> | grep <user>


Last edited by vbe; 10-11-2012 at 10:11 AM.. Reason: code tags gone in copy /paste...
Sponsored Links
    #3  
Old 10-11-2012
bmk bmk is offline
Registered User
 
Join Date: Dec 2011
Last Activity: 31 October 2013, 9:16 AM EDT
Posts: 262
Thanks: 1
Thanked 22 Times in 22 Posts
Try like...


Code:
 ls -ltr| awk '{if($3=="ratih") print}'

    #4  
Old 10-11-2012
muhnandap muhnandap is offline
Registered User
 
Join Date: Sep 2012
Last Activity: 3 October 2013, 3:24 AM EDT
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by vbe View Post
simply using grep with ls, or more tricky using the command find...
With grep precedance is important (is it date or user most important?) but since you want 2 conditions hte importance is less except for performance... (like in sql language...)

You could try to see:

Code:
ls -l |grep <date> | grep <user>

what if I want to make a list from a range of time. like listing the files from june-august??
Sponsored Links
    #5  
Old 10-11-2012
Don Cragun's Avatar
Don Cragun Don Cragun is online now Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 28 July 2014, 2:15 AM EDT
Location: San Jose, CA, USA
Posts: 4,158
Thanks: 162
Thanked 1,417 Times in 1,202 Posts
Quote:
Originally Posted by muhnandap View Post
what if I want to make a list from a range of time. like listing the files from june-august??
There are several possibilities depending on what you want included in the list. Several of them are much easier to implement if you have the desired start time and end time as timestamps on existing files. For a June to August search, create the following files:

Code:
touch -t 201205312359.59 __start__
touch -t 201209010000 __end__

Then if you run ls -lrt you will see the files you want between the listings for __start__ and __end__. If you want files in a file hierarchy not limited to the current directory, you can use something like:

Code:
find <directory_list> -newer __start__ ! -newer __old__

to give you a list of files you want.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search on date range of file based on user input lostincashe Shell Programming and Scripting 5 03-30-2012 03:03 PM
Listing file name and date Jfka UNIX for Dummies Questions & Answers 3 01-20-2011 05:54 AM
listing Directory chronologically based on part of file name Reddy482 Shell Programming and Scripting 3 11-10-2010 01:21 PM
Listing tomorrows date theninja UNIX for Advanced & Expert Users 2 07-08-2009 05:23 PM
long listing of files up to a given date rlh UNIX for Dummies Questions & Answers 2 10-27-2000 09:43 AM



All times are GMT -4. The time now is 02:16 AM.