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 tickets $ what low,medium,high priorite pls define time also
What is computer cli?
Where are cowrie shells found?
How to create environment variables?What are the conditions for creating variables?
Write a script to print the first 10 elements of fibonacci series.
How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?"
What is the difference between running a script as ./scriptname.sh and sh scriptname.sh
Hi, all Scripting professional. Q. I have written script1.sh and calling script2.sh in script1.sh file using bash shell as interpreter and my log in shell also bash shell.My code like Script1 #!/bin/bash echo "My script2 call" . script2.sh Here script2.sh file run successfully but when I have changed my interpreter bash to ksh like #!/bin/ksh Error are comming script2.sh command not found. Guid me how to call other script in our main script.
What are the advantages of using shell scripts?
What is scripting used for?
Write a shell script to get current date, time, user name and current working directory.
What is the first line of a shell script called?