Computing.Net > Forums > Unix > UNIX ls format

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

UNIX ls format

Reply to Message Icon

Name: sandhya2315
Date: September 30, 2009 at 08:09:23 Pacific
OS: Windows XP
Subcategory: General
Comment:

if the file is as;
-rwxrwx--- 1 vadwb gadwb 75 25 abr 13:42 CONTADOR.ENT.D070120
i need only the file name and the time"13:42 "
please help



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: September 30, 2009 at 08:33:48 Pacific
Reply:

Are you asking for a shell script? Your OS says Win XP


0

Response Number 2
Name: sandhya2315
Date: September 30, 2009 at 08:35:10 Pacific
Reply:

shell script


0

Response Number 3
Name: nails
Date: September 30, 2009 at 21:56:15 Pacific
Reply:

I don't recognize the format of your ls command, but in the string provided, you are asking for the eighth and the last fields. This awk script prints the 8th field, a space, and the last field:

line="-rwxrwx--- 1 vadwb gadwb 75 25 abr 13:42 CONTADOR.ENT.D070120"

echo "$line"|awk ' { print $8" "$NF } '

Just substitute your ls command for the echo "$line"


0

Response Number 4
Name: ghostdog
Date: October 3, 2009 at 00:03:16 Pacific
Reply:

if the file has spaces, the awk code will break.

# ls -tlr | awk '{for(i=1;i<=7;i++) $i=""}1'

or
# ls -tlr | awk '{for(i=8;i<=NF;i++){printf "%s ",$i};print ""}'

GNU win32 packages | Gawk


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: UNIX ls format

UNIX ls problem www.computing.net/answers/unix/unix-ls-problem/1893.html

UNIX installation from CD www.computing.net/answers/unix/unix-installation-from-cd/1414.html

Read win file from Unix pl_sql www.computing.net/answers/unix/read-win-file-from-unix-plsql/5994.html