Article View: aus.computers.linux
Article #57553Re: ed editor
From: Robi Karp
Date: Thu, 19 Sep 1996 00:00
Date: Thu, 19 Sep 1996 00:00
53 lines
2242 bytes
2242 bytes
In article <323BE5FD.581B63BA@zip.com.au> "Grahame M. Kelly" <gmkelly@zip.com.au> writes: : Ron wrote: : > : > Hi I'm just learning UNIX, so far I enjoy it! : > : > How do I add a piece of text to a line that already is in the buffer? : > ex., : > : > : > The Super Fast Brown Fox Jumps Over the Lazy Dog. : > The Super Fast Brown Fox Jumps Over the Lazy Dog. : > : > I have 6 of these lines and I need to add a number starting with 1 thru : > 6 in front of the word The. : : Hi Ron, : : Welcome on the Linux bandwagon. The most simple way is to use "vi" : and at the command entry do ":nu" which will automatically number : each line. He actually wants to add it to the file, not just display the line number so doing this won't help. Ron, depending on what you want to achieve there are different tools that will do different things. For example, perhaps the easiest way to add line numbers to a file is to use car. If your file is called f1 you could do the following: % cat -n f1 > f2 % mv f2 f1 If in doubt look at the manual entry (man cat). If you want to edit the file then different editors are available. ed is good but you really need to learn about regular expressions before you can use it to its full advantage. You could use vi, but you could also use emacs. I don't want to start any editor-religion wars here so it's perhaps best if I say that you should have a bit of a look at both of these editors and decide what suits you the best. However emacs... :-) - Robi -- email: robi@interaus.net "Charlotte agreed, what was needed was tel : (+61) (2) 879 9007 a man with a whip". fax : (+61) (2) 879 9200 E. M. Forster, A Room With a View
Technical Details
Message-ID:
<w0loe7icpy.fsf@sydsun.itsyd.bhp.com.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<323B725F.3927@gte.net> <323BE5FD.581B63BA@zip.com.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102983,fdab3ab21cc3205 X-Google-Attributes: gid102983,public From: robi@itsyd.bhp.com.au (Robi Karp) Subject: Re: ed editor Date: 1996/09/19 Message-ID: <w0loe7icpy.fsf@sydsun.itsyd.bhp.com.au> X-Deja-AN: 181478054 sender: robi@sydsun.itsyd.bhp.com.au references: <323B725F.3927@gte.net> <323BE5FD.581B63BA@zip.com.au> organization: BHP Information Technology reply-to: robi@itsyd.bhp.com.au newsgroups: aus.computers.linux