[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] listar arquivos em orde
From: |
Fred |
Subject: |
Re: [shell-script] listar arquivos em orde |
Date: |
Tue, 22 Jan 2002 09:27:17 -0400 (AMT) |
Ol? S?rgio,
Achei sua quest?o um tanto curiosa.
Resolvi fazer o seguinte teste.
# mkdir num
# cd num/
# touch aaa1 aaa2 aaa3 aaa4 aaa5 aaa11 aaa12 aaa13 aaa14 aaa21 aaa22 aaa23
aaa24 aaa31 aaa32 aaa33 aaa34 aaa41 aaa42 aaa43 aaa44
# ls -l
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa1
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa11
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa12
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa13
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa14
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa2
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa21
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa22
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa23
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa24
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa3
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa31
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa32
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa33
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa34
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa4
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa41
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa42
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa43
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa44
-rw-r--r-- 1 root root 0 Jan 22 09:21 aaa5
# ls | awk '{print}'
aaa1
aaa11
aaa12
aaa13
aaa14
aaa2
aaa21
aaa22
aaa23
aaa24
aaa3
aaa31
aaa32
aaa33
aaa34
aaa4
aaa41
aaa42
aaa43
aaa44
aaa5
Ent?o a partir da? ? poss?vel manipular o que voc? precisa...
ordenar=`ls |awk '{print}'`
Espero ter ajudado.
----
Fred - Dept. Linux
Planae Inform?tica
On Tue, 22 Jan 2002, Sergio A Lima J?nior wrote:
> Date: Tue, 22 Jan 2002 09:03:36 -0200
> From: Sergio A Lima J?nior <address@hidden>
> Reply-To: address@hidden
> To: address@hidden
> Subject: [shell-script] listar arquivos em orde
>
> X-AntiV?rus: este e-mail passou pelo antiv?rus AMaViS 0.2.1
> (http://amavis.org/)
> Status: O
>
> Bom dia,
>
> preciso executar o sort de modo que liste o arquivo em ordem numerica,
> exemplo:
>
> # sort listabkp
> linha1.tgz
> linha10.tgz
> linha11.tgz
> linha12.tgz
> linha2.tgz
> linha20.tgz
> linha21.tgz
> linha22.tgz
> linha3.tgz
> linha30.tgz
> linha31.tgz
> linha32.tgz
> linha4.tgz
> linha5.tgz
> linha6.tgz
> linha7.tgz
> linha8.tgz
> linha9.tgz
>
> Observem que o comando n?o lista os arquivos em ordem correta, considerando
> que o arquivo linha10.tgz esta sendo considerado menor que o linha2.tgz e
> assim sucessivamente, algu?m sabe como resolver isto.
>
> Atenciosamente,
>
> ==================================
> Sergio A Lima Junior
> Linux User ID. #229772
> Kernel 2.4.5
> address@hidden
> ==================================
>
>
> Sair da lista: address@hidden
> Banco Dados: http://www.egroups.com/group/shell-script
>
> Seu uso do Yahoo! Grupos ? sujeito ?s regras descritas em:
> http://br.yahoo.com/info/utos.html
>