LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (http://www.linuxquestions.org/questions/red-hat-31/)
-   -   how to add a charachter on every line in vi editor (http://www.linuxquestions.org/questions/red-hat-31/how-to-add-a-charachter-on-every-line-in-vi-editor-642335/)

shahz 05-15-2008 04:42 AM

how to add a charachter on every line in vi editor
 
Hi,

I have a large list for blocking porno sites. I need to add a dot on every line within vi editor can any budy tell me that what will be the all in one command to add a dot on every line.

thanks in advance

ilikejam 05-15-2008 05:08 AM

You'd be faster in sed, e.g.

sed -i 's/$/./g' filename

will add a dot at the end of each line in 'filename'

Dave

indeliblestamp 05-15-2008 05:46 AM

%s/.*/&.
i.e on every line of the file/select the whole line/replace with the whole line followed by a dot.

chrism01 05-15-2008 11:57 PM

vi

:%s/$/./

shahz 05-16-2008 12:06 AM

it should be the beggning of line not the end of line. a dot on the beggining of line. for example


.xyz.com
.abc.com
.najo.com

chrism01 05-19-2008 12:28 AM

Why didn't you say :)

vim

:%s/^/./


All times are GMT -5. The time now is 11:39 PM.