echo "eh]" | sed -r 's/[\]a]/lol/g' returns eh] instead of ehlol. no errors are raised so I assume \] is some kind of sed magic. Im tired of constant sed problems, but I have to use it. so how to escape ] in sed substition expression?
How to escape ] char in character class in sed
919 Views Asked by nah At
1
There are 1 best solutions below
Related Questions in SED
- Delete the extra space after special character in all the lines of text file
- Using sed to substitute in a single record
- sed: make changes in the same file on Windows
- while read line out of scope
- Need to edit a line from particular section inside a file using sed in linux
- How to filter data from flat file with multiply lines pattern using awk or sed tool?
- Sed replace string, based on input file
- Sorting unique elements column-wise in a text-file
- grep/sed replace no match with blank space
- Edit huge sql data file
- Path of the current, parents and root directory
- Using sed, awk or grep to split a string with numbers
- Sed & Regex: match between two characters only sometimes successful
- convert first column from hex to decimal using awk
- Bash: Replace values of a column while retaining line order.
Related Questions in ESCAPING
- Escape dot in jquery validate plugin
- Java character escaping
- MySQLI- Allow the Forward Slash to be Used With Insert Statement
- "stringByAddingPercentEncodingWithAllowedCharacters" replaces more characters than it should
- JSON (schema) validation with escaped characters in patterns fails
- Converting control characters to escape sequences in C#
- How to enter an escape sequence when using ProcessBuilder to open Windows file explorer and highlight the file?
- Python-like Byte Array String representation in C#
- Bash quotes disable escaping
- how to replace a part of string when it contains a metacharacter in perl
- Using a BackSlash in Java
- Escape character for Location of char in a string: R lang
- Executing Python Script from C++ program in Windows XP
- Setting ng-model to a string containing </script> clogs angular?
- Substitution of variable into link with many interior quotes - how to escape correctly
Related Questions in SUBSTITUTION
- Proper rendering of Sphinx substitutions in httpdomain extension
- .htaccess issues- need to extract a new rewritebase and make a filename substitution into a variable
- Regexes for validating & formatting numbers with different decimal delimiters
- perl: substitute pattern with pattern of different size
- Multi-character substitution cipher algorithm
- rusty with simple bash scripts
- SML - Find element in a list and substitute it
- linux bash build command with strings from csv
- Why the substitution |version| is not working on Sphinx
- I want to strip / clean() a cell of everything except CHAR(015), but ASCII Control Characters can't SUBSTITUTE() out
- How to write ASCII 026 char on iPhone
- Understanding behavior of backreferencing in vim
- swapping values
- How to update the value of a field in a column with value from another field only in specific conditions (context)?
- How to match and substitute within pattern in VIM - How to match and substitute text within two characters VIM
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can simply use
echo "eh]" | sed -r 's/[]a]/lol/g':]as first character inside the brackets.]and\have some specialties when used inside brackets. Let me cite from the documentation: