How to replace text with space in vi?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to replace text with space in vi?
# 1  
Old 03-02-2016
How to replace text with space in vi?

Hi,

In the vi editor, I could do a search and replace:

:%s/work/play/g

but how do I do this for a string/text with space? like if I want to replace all text of "come here" with text "go there"? I've tried with quotes, double quotes, back slash, none of them worked.

thanks!

Jay
# 2  
Old 03-02-2016
try:
Code:
s/come here/go there/g

This User Gave Thanks to rdrtx1 For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Changing only the first space to a tab in a space delimited text file

Hi, I have a space delimited text file but I only want to change the first space to a tab and keep the rest of the spaces intact. How do I go about doing that? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies

2. UNIX for Dummies Questions & Answers

replace %20 with space

Hi, I need torename filenames with %20 to space in a batch wise.Can anyone help me please. Need it badly Eg. English%20Brochure%20002-1 to be replace to English Brochure 002-1 Thanks a lot Please use and tags when posting code, data or logs etc. to preserve formatting... (8 Replies)
Discussion started by: umapearl
8 Replies

3. Shell Programming and Scripting

replace 3rd field of space delimited text file

how to replace the 3rd colum? Each line begins similarly, but they all ends variously. XX YY 03 variable text here XX YY 03 more variable text here XX YY 03 even more variable text here really long setence XX YY 03 variable numbers also appear 03 11. 123 456 XX YY 03 the occasional comma,... (4 Replies)
Discussion started by: ajp7701
4 Replies

4. Programming

Replace one space with nothing

hi, d o g e v o l i want a perl command for the above string which should change to the below dog evol replace one space with nothing and two spaces with one space. Thanks, Amey (3 Replies)
Discussion started by: ameyrk
3 Replies

5. Shell Programming and Scripting

Replace every other space

I'd like a sed command to replace every other space in my file. File: 0 1 0 3 0 2 0 5 Want: 01 03 02 05 Does anyone have any ideas? (9 Replies)
Discussion started by: peanuts48
9 Replies

6. Shell Programming and Scripting

Replace long space to become one space?

Hi, i have the log attached. Actually i want the long space just become 1 space left like this : Rgds, (12 Replies)
Discussion started by: justbow
12 Replies

7. Shell Programming and Scripting

Replace space

Hai masters, If a file contains content of 2000 lines, from which i need to remove the first n characters or first n spaces from each line of the file. If suppose to remove n characters or first n spaces from a single line means, just use the command nx. But from the above scenario,... (9 Replies)
Discussion started by: ecearund
9 Replies

8. Shell Programming and Scripting

How to replace all entries of comma in text file by space or other character

Hi , How to replace all entries of comma in text file by space or other character. cat temp.txt A,B,C,D I want this file to be like A B C D Please help!!! (4 Replies)
Discussion started by: prashant43
4 Replies

9. Shell Programming and Scripting

read space filled file and replace text at specific position

Hi I have a spaced filled file having records like below: What I want is to read line having RT3 at position 17-19 then go to position 2651 check the 18 characters (might be space filled till 18 characters). This position should have a... (6 Replies)
Discussion started by: COD
6 Replies

10. UNIX for Dummies Questions & Answers

text formating/Text space padding

Hi, How do I format the following? I have a for loop that retrieves me the path and file name of a file. In column fashion I would like to add the time and another variable containing the file's size. This will result in all the time being under each other and all the file size's being under... (6 Replies)
Discussion started by: hugow
6 Replies
Login or Register to Ask a Question