Hai all, please help


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Hai all, please help
# 1  
Old 03-22-2011
Hai all, please help

i'm new at UNIX, and i;ve wonderd - can i write an alias that will show me only files from today? (not directories) ls -somthing, or some script that works with date...
Smilie
Thanks
# 2  
Old 03-22-2011
What shell are you using (bash, ksh, etc.), what flavor of UNIX (linux, solaris, etc.)?
# 3  
Old 03-22-2011
basic unix (text only), and please tell me how do i check my shell/flavor??
as i said - i'm a newbe... :-)
# 4  
Old 03-22-2011
To check which Unix flavor you are using:
Code:
uname -a

To check which shell:
Code:
echo $SHELL

# 5  
Old 03-22-2011
Quick and crude.
Assumes no files older than one year.
Assumes that your "ls -la" output has the date as "Mmm dD"
Code:
(e.g. "Apr 31" "Mar  4").

Note the extra space character for days 1-9 .

Only clever thing in the "date" command is the double quotes which we use to preserve space characters and the %e which gives the day of the month with leading space for single digit day of month.
The "grep" is looking for lines in the "ls -la" output which start with a hyphen character (i.e. Only files).

Code:
TODAY="`date '+%b %e%'`"        # Mmm dD
ls -la | grep "${TODAY}" | grep \^\-


Note: This is not a commercial solution because it cannot distinguish this year and older years. The commercial approach would use "touch" to create a reference file timestamped at the start of the day, then find files relative to that reference file.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Solaris

hai

how can i delete a secondary group from a perticler user in solaris9 (1 Reply)
Discussion started by: nag.mi2000
1 Replies

2. Shell Programming and Scripting

Hai delete the records

Hai all i want to grep the particular pattern and move the mathing records to torget file and delete the matching recodrs from source file. patterns are position based, like 13413432,aaaaaaa,dsfdddddd,34234324,22224555 13413432,aaaaaaa,dsfdddddd,12234324,11222455 i want to move the... (1 Reply)
Discussion started by: readycpbala
1 Replies
Login or Register to Ask a Question