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 language is bash written in?
i have 2 tables 4 colums table 1 respective values a1 6, a2 8,a3 9,a4 14 & table 2 respective values a1 6, a2 8, a3 9, a4 12. if compare 2 tables 3 colums values same then 4th column values 1)Qes diff >5 then (5 * diff value ) 2)Qes diff <5 the 5 3)Qes diff 5 then 5 print respective values..
What are script files?
What does chmod do?
What is the difference between scripting and coding?
What is the difference between a variable and value?
What is the use of "shift" command in passing parameters?
How do I open a jshell in cmd?
How to group the commands in shell scripting?
How do I debug a shell script?
How do I set bash as default shell mac?
What is the use of "$?" Sign in shell script?