Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all,
i want to listing the file group by file extenstion (type)
i have 4 .csh and 2 .txt and 3 csv file in my current dirm i want to know only the type of file extenstion like this
csh
txt
csvi tired one command but its listing all file type. not listing uniq records
$ ls -rtl | awk '{ print $8 }' | awk -F"." '{print $NF}' | uniq -upls help on this.

I think you have your field count wrong and you probably do not want the -u flag on uniq:
ls -rtl | awk '{ print $9 }' | awk -F"." '{print $NF}' | uniqBut I don't see why you need to do a long listing:
ls -rt1 | awk -F"." '{print $NF}' | uniq
Above, that is a "1" - not an "l"

Nail, the above command is working but it returning duplicate values also
Let me take my example:
my folder has totally 38 files, in that
28 perl files and 10 txt file are thereIf i execute your command its returning
pl
txt
pl
txt
pl
txtBut i want the output like this
pl
txtThanks

Thanks Nails, i tried your command with sort command
its working, see the below command and output$ ls -rt1 | awk -F"." '{print $NF}' | sort | uniq
output:
pl
txtThanks

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