Maybe something like this:
sed 's/ab/~~/g; s/bc/ab/g; s/~~/bc/g'
Replace ~
with a character that you know won’t be in the string.
Related Posts:
- How to replace tabs with spaces in Atom?
- How can I do a recursive find/replace of a string with awk or sed?
- What does ** (double star/asterisk) and * (star/asterisk) do for parameters?
- Renaming column names in Pandas
- Python integer incrementing with ++ [duplicate]
- What is the := operator?
- What does “:=” mean in Pseudocode? [closed]
- Is it bad practice to comment out single lines of CSS with //?
- What is the result of % in Python?
- How to replace all occurrences of a string in JavaScript
- What does “while True” mean in Python?
- What’s the meaning of “=>” (an arrow formed from equals & greater than) in JavaScript?
- Replace ‘ with \’ in a string
- Arrow operator (->) usage in C
- What is newline character — ‘\n’
- MySQL string replace
- Is double square brackets [[ ]] preferable over single square brackets [ ] in Bash?
- IndentationError: unexpected indent error
- TypeError: ‘float’ object is not subscriptable
- syntax error: unexpected token <
- TypeError: ‘float’ object is not subscriptable
- What does operator “dot” (.) mean?
- Putting a simple if-then-else statement on one line [duplicate]
- How can I do a line break (line continuation)?
- How do you comment out code in PowerShell?
- How do I break a string in YAML over multiple lines?
- What is the difference between {} and [] in python?
- What does ‘&’ do in a C++ declaration?
- syntaxerror: “unexpected character after line continuation character in python” math
- node.js string.replace doesn’t work?
- How to concatenate string variables in Bash
- How to use operator ‘-replace’ in PowerShell to replace strings of texts with special characters and replace successfully
- Replace substring in PowerShell
- JavaScript error (Uncaught SyntaxError: Unexpected end of input)
- How to grep for case insensitive string in a file?
- syntaxerror: “unexpected character after line continuation character in python” math
- `from … import` vs `import .` [duplicate]
- JavaScript error (Uncaught SyntaxError: Unexpected end of input)
- Tab space in Markdown
- All possible array initialization syntaxes
- PHP “or” Syntax
- How to delete from a text file, all lines that contain a specific string?
- In JavaScript is != same as !==
- How to make “if not true condition”?
- syntaxerror: “unexpected character after line continuation character in python” math
- What does ** (double star/asterisk) and * (star/asterisk) do for parameters?
- Replace part of a string with another string
- -bash: syntax error near unexpected token `newline’
- How do you express binary literals in Python?
- Finding and replacing elements in a list
- What Does This Mean in PHP -> or =>
- How do I iterate over a range of numbers defined by variables in Bash?
- Comments in Markdown
- Can someone explain __all__ in Python?
- How to exit a loop in Python?
- How can I do a line break (line continuation) in Python?
- what is the meaning of == sign?
- How do I pass multiple parameters into a function in PowerShell?
- Looking for a clear description of Excel’s .xlsx XML format
- How do I iterate over a range of numbers defined by variables in Bash?
- Comments in Markdown
- What does the /= operator mean in Python?
- JavaScript replace/regex
- -bash: syntax error near unexpected token `newline’ for display command
- The difference between += and =+
- What is the difference between syntax and semantics in programming languages?
- Replace values in list using Python
- Are multi-line strings allowed in JSON?
- Python: SyntaxError: keyword can’t be an expression
- Are multi-line strings allowed in JSON?
- What does “-ne” mean in bash?
- “sed” command in bash
- Python string.replace regular expression
- What do << or >>> in java mean?
- Nested JSON objects – do I have to use arrays for everything?
- how to replace quotation marks with \”
- How to replace all double quotes to single quotes using jquery?
- Python string.replace regular expression
- Best way to replace multiple characters in a string?
- What is the Java ?: operator called and what does it do?
- What is the purpose of “&&” in a shell command?
- How can I fix MySQL error #1064?
- jQuery if div contains this text, replace that part of the text
- What do >> and << mean in Python?
- Else without if
- How to remove double-quotes in jq output for parsing json files in bash?
- PowerShell string interpolation syntax
- How can I remove a character from a string using JavaScript?
- Is there a difference between `continue` and `pass` in a for loop in python?
- How do you pass a function as a parameter in C?
- How do I convert a float number to a whole number in JavaScript?
- hat does “static” mean in C?
- JavaScript error (Uncaught SyntaxError: Unexpected end of input)
- Best way to replace multiple characters in a string?
- What does `<>` mean in Python?
- How can I output only captured groups with sed?
- Replace and overwrite instead of appending
- How to remove the quotes when reading a variable in jq in shell?
- Shell script “for” loop syntax
- How do you pass a function as a parameter in C?