ls how to not show date


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ls how to not show date
# 1  
Old 12-01-2008
ls how to not show date

Hello,
I'm using ls -laR to print out a list of file and folders. I want to print only the permission, file size and file name. Also, excluding the '.' and '..'.

result from ls -laR:

total 6
drwxr-xr-x 8 user staff 512 Nov 28 16:17 .
drwxr-x--- 16 user staff 1024 Nov 28 16:17 ..
drwxr-xr-x 4 user staff 512 Nov 28 16:17 build
-rw-r--r-- 1 user staff 2672 Nov 28 16:17 build.xml

./build:
total 2
drwxr-xr-x 4 user staff 512 Nov 28 16:17 .
drwxr-xr-x 8 user staff 512 Nov 28 16:17 ..

ideal print result:

total 2
drwxr-xr-x 512 build
-rw-r--r-- 2672 build.xml

./build:
total 0

Any suggestion on how I can do this?
# 2  
Old 12-01-2008
Code:
ls -laR | awk '{print $1,$5,$9}' | egrep  -v ' \.*$'

or just with awk:

Code:
ls -laR | awk '$9 !~ /^\.*$/{print $1,$5,$9}'


Last edited by Autocross.US; 12-01-2008 at 11:58 AM..
# 3  
Old 12-01-2008
Can try to pipe it into this:
Code:
awk '/^[d\-lbcp].+/ {print $1,$2,$NF} /^[^d\-lbcp].+/ {print}'

Will work until filenames with blanks show up.

Last edited by zaxxon; 12-01-2008 at 11:51 AM.. Reason: Added the "p" for pipes.
# 4  
Old 12-01-2008
Thank you so muchSmilieSmilieSmilieSmilieSmilieSmilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Date: invalid date trying to set Linux date in specific format

i try to set linux date & time in specific format but it keep giving me error Example : date "+%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01" or date +"%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01" keep giving me this error : date: invalid date ‘19-01-2017 00:05:01' Please use CODE tags... (7 Replies)
Discussion started by: umen
7 Replies

2. Shell Programming and Scripting

Show the string in date format

Hello guys. how can print the: 20140206 like Fri, Feb 6, 2015 Thank you. (4 Replies)
Discussion started by: Ymir
4 Replies

3. Shell Programming and Scripting

awk to calculate date and show data

data: hostcomment { host_name=myhost01 entry_type=1 comment_id=1 source=0 persistent=1 entry_time=1415723753 expires=0 expire_time=0 author=hpsm comment_data=IM0837437472 } program { modified_host_attributes=1 modified_service_attributes=1 enable_notifications=1... (20 Replies)
Discussion started by: SkySmart
20 Replies

4. Shell Programming and Scripting

How to show one occurence of duplicate date?

Iam having one variable with a value REPORT_MISSING=$(grep -i 'Unable to find an Entry*' cognos_env01_env13_2012-12-20-0111.log | sed 's|Unable to find an Entry for the report \(.*\) in the Security Matrix|\1|g') This give me value as Direct Authorization Error Listing.xml Health... (4 Replies)
Discussion started by: Vikram_Tanwar12
4 Replies

5. Shell Programming and Scripting

Converting a date to friday date and finding Min/Max date

Dear all, I have 2 questions. I have a file with many rows which has date of the format YYYYMMDD. 1. I need to change the date to that weeks friday date(Ex: 20120716(monday) to 20120720). Satuday/Sunday has to be changed to next week friday date too. 2. After converting the date to... (10 Replies)
Discussion started by: 2001.arun
10 Replies

6. Shell Programming and Scripting

How to show last month date?

Hi Guys, Please somebody give me a hand to show the Month & Year in assigning to a variable and with format "MMMYY" (i.e. Jul11). See below preferred output. I tried using this but it is giving me the current month... date = "`date +%b%y`" Aug11 DESIRED OUTPUT: Jul11 ... (3 Replies)
Discussion started by: pinpe
3 Replies

7. Shell Programming and Scripting

Show date/time with tail|grep command

Hi, I have a log file without date/time, and I want that everytime tail|grep find something it displays the date/time and the line. I have tried something like this command but without any luck to display the date/time: tail -F catalina.out | sed "s/^/`date `/" | egrep ... (6 Replies)
Discussion started by: julugu
6 Replies

8. Shell Programming and Scripting

grep to show date/time of file the string was found in.

I've seen several examples of grep showing the filename the string was found in, but what I really need is grep to show the file details in long format (like ls -l would). scenario is: grep mobile_number todays_files This will show me the string I'm after & which files they turn up in, but... (2 Replies)
Discussion started by: woodstock
2 Replies

9. Shell Programming and Scripting

Is there any way to show timestamp instead of date in "ls –l"

Hello is there any way build in by unix native commands to show timestamp instead of date when I do "ls -l" ? if not is there any one liner script to do this? thanks (1 Reply)
Discussion started by: umen
1 Replies

10. Shell Programming and Scripting

How to show yesterday date

HI all, i am a junior learner, can u teach me how to show yesterday time with unix command? thanks! Cloud (1 Reply)
Discussion started by: wind_n_cloud
1 Replies
Login or Register to Ask a Question