Skip to content

Instantly share code, notes, and snippets.

@quickgrid
Created April 1, 2016 04:25
Show Gist options
  • Save quickgrid/f00d3f11aa03b4f403ec47409f51a3c1 to your computer and use it in GitHub Desktop.
Save quickgrid/f00d3f11aa03b4f403ec47409f51a3c1 to your computer and use it in GitHub Desktop.
The code replaces all the matches in the given text file with the given string.
#!/bin/bash
pattern="abc"
replacedValue="cde"
sed -i "s/$pattern/$replacedValue/g" sedInput.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment