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 the meaning of First line of shell script ,what is meaning of #! pleas explain brifly
what is "umask"?
What are the advantages of shell scripting?
Is shell scripting a programming language?
What is a command line shell?
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.
How do I set bash as default shell mac?
How do you schedule a command to run at 4:00 every morning?
What is $1 in shell scripting?
In a file , how to retrieve the lines which are the multiples of 50 ? like 50,100,150th lines etc.
How do I edit a .sh file?
Explain about the slow execution speed of shells?