How to add a character on every line in vi editor

How to add a character on every line in vi editor

Saturday, August 01, 2015

3:22 AM

Old

05-15-2008, 05:08 AM

#2

ilikejam

Senior Member

Contributing Member

Registered: Aug 2003

Location: Glasgow

Distribution: Fedora / Solaris

Posts: 3,109

Rep:

Reputation: 96

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

Old

05-15-2008, 05:46 AM

#3

indeliblestamp

Member

Registered: Feb 2006

Distribution: Fedora

Posts: 341

Blog Entries: 3

Rep:

Reputation: 38

%s/.*/&.

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

Inserted from <http://www.linuxquestions.org/questions/red-hat-31/how-to-add-a-charachter-on-every-line-in-vi-editor-642335/>

Created with Microsoft OneNote 2016.


How to add a character on every line in vi editor

How to add a character on every line in vi editor

Saturday, August 01, 2015

3:22 AM

Old

05-15-2008, 05:08 AM

#2

ilikejam

Senior Member

Contributing Member

Registered: Aug 2003

Location: Glasgow

Distribution: Fedora / Solaris

Posts: 3,109

Rep:

Reputation: 96

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

Old

05-15-2008, 05:46 AM

#3

indeliblestamp

Member

Registered: Feb 2006

Distribution: Fedora

Posts: 341

Blog Entries: 3

Rep:

Reputation: 38

%s/.*/&.

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

Inserted from <http://www.linuxquestions.org/questions/red-hat-31/how-to-add-a-charachter-on-every-line-in-vi-editor-642335/>

Created with Microsoft OneNote 2013.