English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How to replace a word with other in a file.. whats the command in Unix.

2006-07-27 01:04:30 · 3 answers · asked by Anonymous in Computers & Internet Software

3 answers

To replace the first occurance on each line:
$ sed 's/word1/word2/' infile >outfile

To replace every occurance in the file:
$ sed 's/word1/word2/g' infile >outfile

2006-07-27 08:08:43 · answer #1 · answered by BalRog 5 · 2 0

The command is sed. I don't use it enough to give you the exact syntax for the command but the man page is excellent. This is assuming that the file in question is a text file. If it is a binary file then you will need a hex editor and alot of patience.

2006-07-27 08:59:09 · answer #2 · answered by John K 4 · 1 1

just enter in insert mode and del that character and enter new character

2006-07-27 08:30:20 · answer #3 · answered by Anonymous · 0 2

fedest.com, questions and answers