Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

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"

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 ""}'

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |