[ILUG] sed
Baruch Even
baruch at ev-en.org
Sun Jul 11 13:52:18 IST 2004
* olearypj at rte.ie <olearypj at rte.ie> [040711 14:14]:
> Hi Timothy,
> Thanks for the reply, this is a bit of the output form "od -c email"
> where I thought the blank lines were, or at least thats what it looks when I
> look at the email as a text file.
>
> 0003560 : r o o t @ a u s - c i t y .
> 0003600 c o m \r \n \r \n \r \n O S C A R 7
> 0003620 \r \n 1 0 7 5 3 0 U 7 4 0 8 9
>
> The \r \n characters between city.com & oscar 7 is where I thought the blank
> lines were
For some reason your mail has dos end of lines (\r\n) instead of unix
eol (\r).
sed is confused for that, try a file with the content:
---
aaa
bbb
---
Once load it in vim, set ff=unix, write it and run your sed script,
and again set ff=dos, write and test with sed. The ff=dos case fails.
The problem is that the line is not empty as far as sed is concerned, it
has a \n character in it.
You can try the command: sed -e '1,/^[[:space:]]\?$/d'
to try to handle lines with a single space in them (\n is a space).
I couldn't find how to specify \n by itself.
Baruch
More information about the ILUG
mailing list