If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > help with vi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-21-05, 11:10
cougartrace cougartrace is offline
Registered User
 
Join Date: Oct 2005
Posts: 26
help with vi

I have a file that has bout 375 lines. I want to put a rm in front of each line.

Is there a vi command that will help me accomplish this?

CougarTrace
Reply With Quote
  #2 (permalink)  
Old 11-21-05, 13:14
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,454
:%s/^/rm /
Reply With Quote
  #3 (permalink)  
Old 11-21-05, 13:17
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,454
In case you're curious, here's an explanation:
Code:
:       enter command mode
%       for each line
s       substitute
/^      at the beginning of the line
/rm /   whatever you want
Reply With Quote
  #4 (permalink)  
Old 11-21-05, 13:18
cougartrace cougartrace is offline
Registered User
 
Join Date: Oct 2005
Posts: 26
thanks

Thanks. It worked.

CougarTrace
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On