[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ilug
Subject:    Re: [ILUG] echo and cat
From:       kevin lyda <kevin+dated+1057070096.9eb929 () ie ! suberic ! net>
Date:       2003-06-26 14:34:53
Message-ID: 20030626153453.C15903 () ie ! suberic ! net
[Download RAW message or body]


On Thu, Jun 26, 2003 at 02:41:21PM +0100, Kae Verens wrote:
> If I want to place a single line at the top of a text file, what's the 
> most efficient way to do this using the console?
> 
> I had thought it would be something like this:
> echo lintoplaceontop | cat filename > filename
> 
> but, that doesn't do it.

sed '1i\
lintoplaceontop' < filename > filename.$$; mv filename.$$ filename

kevin

-- 
kevin@ie.suberic.net      Democracy is the theory that the common people know
fork()'ed on 37058400     what they want and deserve to get it good and hard.
meatspace place: home          -H. L. Mencken  ~~~~~  uk tabloid busting: 
http://ie.suberic.net/~kevin/  http://www.cec.org.uk/press/pw/latest.htm

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic