How would you replace the n character in a file with some
xyz?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
What is path in shell script?
What is web script?
What is the first line of a shell script called?
How to pass an argument to a script?
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.
Is powershell a bash?
Suppose you execute a command using exec, what will be the status of your current process in the shell?
Print the 10th line without using tail and head command.
What is the meaning of $1 in shell script?
whta is the use of "exec" command?
Explain about shebang?
How do I open a jshell in cmd?