The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
replace charandevu Shell Programming and Scripting 6 04-07-2008 11:30 AM
replace last / by | naikaa Shell Programming and Scripting 6 01-17-2008 02:19 AM
Replace \n with \r\n Chanakya.m Shell Programming and Scripting 3 07-19-2006 07:20 AM
How to replace using SED? mahatma Shell Programming and Scripting 4 03-23-2006 03:04 PM
Replace jda2001 UNIX for Dummies Questions & Answers 2 09-06-2005 02:20 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-25-2007
ravi.sadani19 ravi.sadani19 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 42
How to replace into Vi

Ravi .
Pawan 19.23
sanjeeva .

I want to replace '.' into 'NULL' not the dot between 19.23 .. only single dots to NULL

how to do replacement after opening file in Vi
  #2 (permalink)  
Old 06-25-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Code:
:%s/ *\. */NULL/g
:w
  #3 (permalink)  
Old 06-25-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Vino,
Your substitution will replace all instances of '.', including '19.23'.
The Regular Expression ' *' means zero or more instances of space.
In other words, it will consider anything as true, as any non-space
character means zero instances of space.
Also the solution should keep the space after the name.
Here is one possible solution:
Code:
:%s/ \./ NULL/
  #4 (permalink)  
Old 06-25-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by Shell_Life View Post
Vino,
Your substitution will replace all instances of '.', including '19.23'.
The Regular Expression ' *' means zero or more instances of space.
In other words, it will consider anything as true, as any non-space
character means zero instances of space.
Also the solution should keep the space after the name.
Here is one possible solution:
Code:
:%s/ \./ NULL/
Good catch !
  #5 (permalink)  
Old 06-25-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Thanks, you are a great player.
Cheers.
  #6 (permalink)  
Old 06-25-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
It should have read
Code:
:%s/ \{1,\}\. \{0,\}/ NULL/g
Ah.. its an overkill !
Sponsored Links
Closed Thread

Bookmarks

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 10:38 AM.


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