If I understand correctly, you want to replace all space occurances to "\space" where space represents the space, ' ', character:
sed -i 's/ /\\ /' [i]file[/i]
sed — Is the program.
-i — Is a sed option that can edit files in place (makes backup if extension supplied)
s/ / — Finds all occurances of space
\\ / — Replaces the space with '\ '. Without the single quotation marks. file — Is the input file.
For reference, the s command is the substitution command. The / / statement is to find any occurance of a space. The \\ / statement will replace the space, ' ', found with '\ '.
I am designing a text translator in which I have to replace a array of string to another string :
cmptr is an elctrnc mchn
It should be translated to : computer is an electronic machine.
(Irrespective of the case-senitivity)
Can anyone help me?
Hello folks, i have been search hard on this one, any help is apperciated. I want to take what is in the clipboard and replace all occurances of " " (space) that occurs between numbers with "" (ie, remove spaces between numbers). So if the clipbaord has 3 1 1 1. it would replace it with 3111. Thanks