Search code examples
stringbashshellcommand-linecygwin

Cygwin replace all instances of a character in a text file


I have a text file that has numerous instances of the character '^'. I need all those instances replaced with a '['.

I prefer to use cygwin but would use windows command prompt if there is a direct way to do this. My initial instinct was to use Access (no other DB installed) to use the 'replace' function, but as I'm connecting using Jet - apparently this is not possible as per Exception when trying to execute "REPLACE" against MS Access

What's the cleanest way to achieve this?


Solution

  • Try this:

    sed -i 's/\^/\[/g' myfile