Re: Help: How to add a character in the line



Amy Lee <openlinuxsource@xxxxxxxxx> wrote:
Hi,

I'm a Linux user, I'd like to know how to use sed or other command to add
a character in the line. Like this:

Original line:

16jh_1010

Hope it to be:

16>jh_1010

Here is a simple example of how to solve your problem:

$ echo '16jh_1010' >file
$ cat file
16jh_1010
$ sed 's/^16/&>/' file
16>jh_1010

If you are serious about using 'sed', you should learn as much as
possible about regular expressions and the syntax of 'sed'. There
are several good tutorials on the web and also a book published by
O'Reilly named "sed & awk".

Here is a good place to start:

http://www.grymoire.com/Unix/index.html

--
Kenan Kalajdzic
.



Relevant Pages