[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Usando awk + sub
From: |
Tiago Peczenyj |
Subject: |
Re: [shell-script] Usando awk + sub |
Date: |
Mon, 1 Apr 2013 16:12:11 -0300 |
tres formas de fazer
$ echo '/tmp/jasper.txt' | tr '.-' ' ' # são DOIS espaços
/tmp/jasper txt
$ echo '/tmp/jasper.txt' | sed 's/[.-]/ /g'
/tmp/jasper txt
$ echo '/tmp/jasper.txt' | awk '{ gsub("[.-]"," ",$1); print $1}'
/tmp/jasper txt
2013/4/1 Gustavo Soares [SLot] <address@hidden>
> **
>
>
> Pessoal, gostaria de uma ajudinha com o awk, usando o sub, consegui
> usando a linha abaixo, mas não gostaria de usar o sed, mas fazer tudo
> direto no awk.
>
> root@testejava:/root>awk 'NR=1 {if ( $1 == "JasperPrint" ) print $2}'
> /tmp/jasper.txt
> LBANCO.703-687
> root@testejava:/root>awk 'NR=1 {if ( $1 == "JasperPrint" ) print $2}'
> /tmp/jasper.txt | sed 's|\.| |g;s|-| |g'
> LBANCO 703 687
> root@testejava:/root>
>
> O que gostaria era de trocar o "." e o "-" por espaço.
>
> --
> -------------------
> SLot
> Linux User: 124842
> XMPP: address@hidden
>
>
>
--
Tiago B. Peczenyj
Linux User #405772
http://about.me/peczenyj
[As partes desta mensagem que não continham texto foram removidas]