Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How would you replace the n character in a file with some
xyz?

Answers were Sorted based on User's Feedback



How would you replace the n character in a file with some xyz?..

Answer / ram

* sed 's/n/xyz/g' filename > new_filename
s -search and replace
n -character to be replaced
xyz - character to replace
g -global

* vi filename
:%s/n/xyz/g --search and replace
:w! ---save

Is This Answer Correct ?    8 Yes 0 No

How would you replace the n character in a file with some xyz?..

Answer / vipul dalwala

sed -i 's/n/xyz/g' filename

Is This Answer Correct ?    3 Yes 0 No

How would you replace the n character in a file with some xyz?..

Answer / viswa

In Vi editor,:%s/n/xyz/g

Is This Answer Correct ?    2 Yes 0 No

How would you replace the n character in a file with some xyz?..

Answer / sasmita

:1,$ s/n/xyz/g

Is This Answer Correct ?    1 Yes 0 No

How would you replace the n character in a file with some xyz?..

Answer / seshadri sethi

sed ’s/n/xyz/g’ filename > new_filename



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 replacemet.

Is This Answer Correct ?    1 Yes 0 No

How would you replace the n character in a file with some xyz?..

Answer / suresh raju

sed 's/.\{1,75\}/xyz/g' filename

here n=75. so 75 characters will be replaced with xyz

Is This Answer Correct ?    1 Yes 0 No

How would you replace the n character in a file with some xyz?..

Answer / tony

cat filename | sed 's/n/xyz/g' > newfile

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Shell Script Interview Questions

What is path in shell script?

0 Answers  


What is web script?

0 Answers  


What is the first line of a shell script called?

0 Answers  


How to pass an argument to a script?

0 Answers  


How to sort a result of Ls -l command based on columns. Ex. i want to sort 5th column from output of ls -l command.

6 Answers   TCS,


Is powershell a bash?

0 Answers  


Suppose you execute a command using exec, what will be the status of your current process in the shell?

0 Answers  


Print the 10th line without using tail and head command.

0 Answers  


What is the meaning of $1 in shell script?

0 Answers  


whta is the use of "exec" command?

1 Answers  


Explain about shebang?

0 Answers  


How do I open a jshell in cmd?

0 Answers  


Categories