You can use the change command to replace the entire line, and the -i
flag to make the changes in-place. For example, using GNU sed:
sed -i '/TEXT_TO_BE_REPLACED/c\This line is removed by the admin.' /tmp/foo
More Related Contents:
- Shell script – remove first and last quote (“) from a variable
- How to check if a string contains a substring in Bash
- Escape a string for a sed replace pattern
- How to use sed/grep to extract text between two words?
- How do I use variables in single quoted strings?
- Extract substring in Bash
- Case insensitive comparison of strings in shell script
- Multi-line string with extra space (preserved indentation)
- How to echo “$x_$y” in Bash script?
- Convert specified column in a multi-line string into single comma-separated line
- Test for empty string with X”” [duplicate]
- Split bash string by newline characters
- How to split one string into multiple strings separated by at least one space in bash shell?
- How can I compare a string to multiple correct values in Bash?
- Count word occurrences in R
- Compare version strings in groovy
- Extract numeric part of strings of mixed numbers and characters in R
- How can I check the version of sed in OS X?
- Use character string as function argument
- Any method equivalent to PadLeft/PadRight?
- Delete certain lines in a txt file via a batch file
- When using the MOV mnemonic to load/copy a string to a memory register in MASM, are the characters stored in reverse order?
- Escaping forward slashes in sed command [duplicate]
- How to join multiple lines of filenames into one with custom delimiter
- Excel VBA like operator [closed]
- How to tell if a string is not defined in a Bash shell script
- The History Behind the Definition of a ‘String’ [closed]
- How can I replace newline characters using JSP and JSTL?
- Remove all line breaks at the beginning of a string in Swift
- How to grep for case insensitive string in a file?