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?
- Renaming column names in Pandas
- Python integer incrementing with ++ [duplicate]
- What is the := operator?
- What does “:=” mean in Pseudocode? [closed]
- What is the result of % in Python?
- Replace ‘ with \’ in a string
- Arrow operator (->) usage in C
- MySQL string replace
- IndentationError: unexpected indent error
- 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?
- What is the difference between {} and [] in python?
- node.js string.replace doesn’t work?
- How to concatenate string variables in Bash
- Replace substring in PowerShell
- `from … import` vs `import .` [duplicate]
- All possible array initialization syntaxes
- PHP “or” Syntax
- How to make “if not true condition”?
- What does ** (double star/asterisk) and * (star/asterisk) do for parameters?
- How do you express binary literals in Python?
- Finding and replacing elements in a list
- How do I iterate over a range of numbers defined by variables in Bash?
- Comments in Markdown
- Can someone explain __all__ in Python?
- Looking for a clear description of Excel’s .xlsx XML format
- Comments in Markdown
- 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
- 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
- What do << or >>> in java mean?
- 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?
- 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?
- 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)
- What does `<>` mean in Python?
- 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?
- How do you pass a function as a parameter in C?
- Ternary operator (?:) in Bash
- SyntaxError invalid token
- How to escape single quotes within single quoted strings
- What is the difference between ‘/’ and ‘//’ when used for division?
- How to replace a whole line with sed?
- Bash syntax error: unexpected end of file
- What does the “at” (@) symbol do in Python?
- the ‘d’ command in the sed utility
- What is :: (double colon) in Python when subscripting sequences?
- Is there a difference between x++ and ++x in java?
- jQuery removing ‘-‘ character from string
- Why are hexadecimal numbers prefixed with 0x?
- RE error: illegal byte sequence on Mac OS X
- Using replace() method in python by index
- What does the `and` keyword mean in OCaml?
- text highlight in markdown
- Syntax error on token(s), misplaced construct(s)
- How to replace multiple substrings of a string?
- How to grep and replace
- What does ‘
- Python def function: How do you specify the end of the function?
- Cross-reference (named anchor) in markdown
- sed command with -i option failing on Mac, but works on Linux
- No Multiline Lambda in Python: Why not?
- What is the difference between sed and awk?
- Syntax error on token “;”, { expected after this token in Random string creator
- Replace a character at a specific index in a string?
- What does @@variable mean in Ruby?
- XSLT string replace
- Lua String replace
- Standard function to replace character or substring in a char array?
- Python def marked as invalid syntax
- Why is System.out.print() not working?
- How to use sed to extract substring
- How do you format an unsigned long long int using printf?
- How to get rows and columns count of a 2D array in Java?
- Why am I getting an ‘Else without previous if’ error within a for loop?
- window.location.replace() not working to redirect browser
- Why virtual & static keywords aren’t allowed outside class declaration?
- PHP syntax question: What does the question mark and colon mean? [duplicate]
- Prolog “or” operator, query
- What does the “Just” syntax mean in Haskell?
- How to display certain lines from a text file in Linux?