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

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

Re: sed não obedece primeira linha em branco


From: Herbert Alexander Faleiros
Subject: Re: sed não obedece primeira linha em branco
Date: Tue, 25 Jul 2006 21:55:50 -0000
User-agent: eGroups-EW/0.82

--- "Tiago Barcellos Peczenyj" escreveu:
> estou usando o GNU sed version 4.0.9 e não funcionou :(


Olá novamente,

estranho, segundo a documentação, desde a 3.02a isso deveria 
funcionar...

Olha só (Slackware -current):

$ sed --version | head -1
GNU sed version 4.1.5


Arquivo de testes:

$ cat arq.txt

teste 09:09

-- teste 09:09

teste 09:09


Substitui a 1a ocorrência:

$ sed '0,/^$/s//xxx/' arq.txt
xxx
teste 09:09

-- teste 09:09

teste 09:09


Remove a 1a linha em branco:

$ sed -i 1d arq.txt


Faz o teste novamente:

$ sed '0,/^$/s//xxx/' arq.txt
teste 09:09
xxx
-- teste 09:09

teste 09:09


Ou seja, funciona! Mesmo quando a ocorrência não está na 1a linha.


Até,

Herbert.








reply via email to

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