Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-19-2010, 12:30 PM   #1
LQ Newbie
Registered: Jul 2009
Posts: 16

Rep: Reputation: 0
Putty VI and Formating

I have been given some instructions in Vi to format some data. Since I'm new I was basically asked to hit ESC in Vi and then type the following in the on the bottom

:$s/,/CTRL-V then while holding down CTRL press M/g

This would format a wall of text into a readable page.

I was wondering if:

a) There was a place I could go to online to learn what the :$s,/,/ symbols and characters where doing

b) I made a mistake once and now some of the characters in the file are highlighted in yellow. I was wondering if we could turn that off or reset the file....sorry my jargon is brutal. :-(
Old 01-19-2010, 12:39 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well the s// stuff ia a regular expression, there are millions of google hits for regular expression tutorials (Also called a regex or regexp)

being in yellow means you searched for it. e.g. in vi hitting /bum will search for bum and highlight all occurrences in yellow. Personally i just search for something that it won't find, e.g. /ewrdhjgklhjg to clear it, but any vi tutorial will tell you the proper way to clear it.
Old 01-19-2010, 05:06 PM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,349

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
What are you trying to do? It looks like you are trying to convert commas to newlines, in which case it's

:1,$s/,/ctrl-v ctrl-m/g
which means from line 1 to last line ($), substitute comma with Ctrl-V Ctrl-M (ie a new line). Do not put the space between ctrl-v ctrl-m, that's just to make it easier for you to read. The 'g' on the end means all occurrences on each line. By default it would only match/amend the first occurrence on each line.
The vim docs are at and are also on your system somewhere eg /usr/share/vim/vim62/doc (62 = version 6.2 : YMMV).


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Putty logs me out / Putty throws me out after I log in ytd Linux - General 15 08-09-2009 03:03 AM
Formating Eugney Linux - Newbie 2 05-02-2005 03:50 AM
formating mfds Linux - Software 7 04-14-2004 11:15 AM
formating Galilee Linux - Software 2 09-30-2003 11:23 PM
formating.... s9722 Linux - Hardware 10 06-17-2003 12:51 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration