hi all,
is there an easy way in ksh to sort the results of a find in say alphabetical order ?? e.g in my script i am doing a find for all servers
find . -name "server.xml"
and the output is not in any order.
thanks in advance.
hi all,
is there an easy way in ksh to sort the results of a find in say alphabetical order ?? e.g in my script i am doing a find for all servers
find . -name "server.xml"
and the output is not in any order.
thanks in advance.
sorry forgot to mention the output currently looks like :
myServerA
myServerB
.
.
myServerN
myServerNew1
myServerNew2
.
.
myServerNew6
myServerO
myServerP
desired output would be :
myServerA
myServerB
.
.
myServerN
myServerO
myServerP
.
.
myServerNew1
myServerNew2
.
.
myServerNew6
try this..
hope it will work
sort -k 1.11 filename
Neat trick! makes mental note
$ cat filename
myServerA
myServerB
myServerN
myServerNew1
myServerNew2
myServerNew6
myServerO
myServerP
$ awk '{print length,$0}' filename|sort -n|cut -d' ' -f2-
myServerA
myServerB
myServerN
myServerO
myServerP
myServerNew1
myServerNew2
myServerNew6