shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [shell-script] ajuda com shell


From: Aurelio Marinho Jargas
Subject: Re: [shell-script] ajuda com shell
Date: Thu, 13 Nov 2003 16:22:07 -0300 (ART)

ae,

 --- marlongare <address@hidden> escreveu: 
> como faço para contar caracteres dentro de uma strings:
> ex: /usr/ruevers/arquivos/novos/teste.txt
> existe algum comando em que eu possa contar quantos
> caracteres "/" dentro desta string.

serve em dois comandos? :)

$ var=$(echo /usr/ruevers/arquivos/novos/teste.txt | sed 's/[^/]//g')

$ echo $var
/////

$ echo ${#var}
5

ou num só:

$ echo -n /usr/ruevers/arquivos/novos/teste.txt | 
  sed 's/[^/]//g' | wc -c
      5

falou!


=====
-- 
Aurelio Marinho Jargas - De volta para Curitiba & Conectiva
Apostila de Shell a venda http://aurelio.net/shell/apostila
Ser tosco eh... http://aurelio.net/fotos

______________________________________________________________________

Yahoo! Mail: 6MB, anti-spam e antivírus gratuito! Crie sua conta agora:
http://mail.yahoo.com.br


reply via email to

[Prev in Thread] Current Thread [Next in Thread]