The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
replace last / by | naikaa Shell Programming and Scripting 6 01-17-2008 02:19 AM
using sed to replace ' with ` mr_dba01 Shell Programming and Scripting 2 08-08-2007 09:24 AM
How to replace ?? preethgideon UNIX for Dummies Questions & Answers 10 02-19-2007 12:08 PM
Replace \n with \r\n Chanakya.m Shell Programming and Scripting 3 07-19-2006 08:20 AM
what to replace XP with? byblyk Linux 2 05-23-2005 08:46 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 11-26-2008
preethgideon preethgideon is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 71
Replace in VI

Hi All,
How to add a '*' at the begining of VI file between lines in a range say 20 -30??

Please help.

I tried :%s/20,30/^/\*/

Did not work.

Thanks and Regards,
Gideon.
  #2 (permalink)  
Old 11-26-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,910
Code:
:20,30s/^/\*/
  #3 (permalink)  
Old 11-27-2008
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
using Perl:
Code:
perl -pi -e 's/^/\*/  if ($. > 19  and  $. < 31);' /foo/bar
  #4 (permalink)  
Old 11-27-2008
FlyingSquirrel FlyingSquirrel is offline
Registered User
  
 

Join Date: May 2008
Posts: 38
Why count lines, use markers instead.

1) Go to the 1st line in range and type in
ma

2) Go to the last line in range and type in
mb

3) Then do the substitution
:'a,'b s/^/*/
Closed Thread

Bookmarks

Tags
vim

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0