shiv
Answered On : Jun 3rd, 2005
sed 's/n/xyz/g' filename > new_filename

3 Users have rated as useful.
Login to rate this answer.
vi file name
then go to command mode
%s/n/xyz/g
Login to rate this answer.
Madhukrishnan
Answered On : Jul 10th, 2006
tail -1 sample.txt | sed 's/.$/xyz/'Check this
Login to rate this answer.
Bala G
Answered On : Aug 13th, 2007
using perl we can do.
perl -p -i -e "s/n/abc/g" file_name
Login to rate this answer.
Pradeep Singh
Answered On : Nov 7th, 2007
We can replace n characters by using the following command:
1,$s/./xyz/g
where 1 shows that the search string will start searching patterns from first line of the file.
'.' for any character.
g for global replacement.
Login to rate this answer.
FOLLOWING IS THE ANSWER FOR REPLACING RANGE OF CHARACTERS IN A LINE OF FILE. HERE 5TH TO 10TH CHARACTERS IN THE FILE text.txt ARE REPLACED BY "XYZ"
cut -c5-10 text.txt | sed 's/^.*$/XYZ/g'
Login to rate this answer.
search for the character n in filename and replace it with xyz.
sed 's/n/xyz/g' filename

1 User has rated as useful.
Login to rate this answer.
sed -i 's///g'
sed -i option will directly changed in the fine. no need to redirect the output and create the another file. Here "g" for globe change.
Shambhu

2 Users have rated as useful.
Login to rate this answer.
After opening the file in vi editor:
come to command mode (press Esc), then type the below command
:s 1,$ s/n/xyz/g enter
Login to rate this answer.
All the sed replacements are by default global. It's in the vi editor that you have to specifically give "g" for global replacement.
Login to rate this answer.
Furkan
Answered On : Mar 30th, 2012
:1,$s/n/xyz/g

1 User has rated as useful.
Login to rate this answer.
venkatachalam babu
Answered On : Dec 10th, 2012
:%s/n/xyz/g
Also be used in VI editer, % means globally
Login to rate this answer.
jbaker
Answered On : Jan 9th, 2013
Also can be done with :g/n/s//xyz/g
Login to rate this answer.
nitin
Answered On : Mar 2nd, 2013
cat cc | sed s/n/xyz/g
Login to rate this answer.