i have to list some file with certain exemption
suppose for example i have two files
file1.log.1
file1.log.1.123
i want ls -ltr command to list only 1st type of files
so i want like this
ls -ltr *.log.*
---------it should grep 1st kind of files but this command greps all the files both of type 1 and 2.
plz help me to list only those file of 1st kind
emery
2
try:
ls -ltr | grep ".log.[0-9]$"
how many kinds of type 1 files do you have. For only those 2 types tested
# ls -ltr *.log.[1-9]
thanks now i m able to get 1st kinf of files.........
but 1st kind of files are also like this
file1.log.123
file1.log.12
file1.log.10
ls -ltr *.log.[1-9]
--------its grepping those file which have till 9,even i wnt to grep all the numbers like for example file1.log.12.
if you are sure you do not have any other characters beside numbers
ls -ltr *.log.? *.log.?? *.log.???
or
ls -ltr *.log.[0-9]*
or just
ls -ltr *.log.[0-9] *.log.[0-9] [0-9] *.log.[0-9] [0-9][0-9]
If you have other more advanced criteria, then the above doesn't really suit your needs....