[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed 0a
From: |
Davide Brini |
Subject: |
Re: sed 0a |
Date: |
Tue, 1 Jun 2010 15:21:25 +0100 |
User-agent: |
KMail/1.12.4 (Linux/2.6.31-gentoo-r10; KDE/4.3.5; x86_64; ; ) |
On Tuesday 01 Jun 2010 14:45:46 address@hidden wrote:
> $ date|sed 0a\\hi
> sed: -e expression #1, char 2: invalid usage of line address 0
> Huh? It is valid in ed(1).
But not in sed. Here's from the docs:
`0,/REGEXP/'
A line number of `0' can be used in an address specification like
`0,/REGEXP/' so that `sed' will try to match REGEXP in the first
input line too.
...
Note that this is the only place where the `0' address makes
sense; there is no 0-th line and commands which are given the `0'
address in any other way will give an error.
To do what you're trying to do, use
date | sed 1i\\hi
although GNU sed also supports
date | sed 1ihi
--
D.
- sed 0a, jidanni, 2010/06/01
- Re: sed 0a,
Davide Brini <=