Skip to content

Instantly share code, notes, and snippets.

View tulik's full-sized avatar
:octocat:
Kubernetes!

Lukasz D. Tulikowski tulik

:octocat:
Kubernetes!
View GitHub Profile
@teamshortcut
teamshortcut / replace.sh
Last active August 2, 2018 09:45
Bash script to go through multiple files looking for certain lines using regex (differing between files) and replacing it with the correct corresponding text (different for each file), grabbed from a list in an external file
#!/bin/bash
#Bash script to go through multiple files looking for certain lines using regex (differing between files)
#and replacing it with the correct corresponding text (different for each file), grabbed from a list in an external file
#Expects to be placed in the same directory as the files to search through
#Relies on 2 external files; a list of filenames to edit, and the corresponding replacement text for each file (separated by newlines)
#Used to escape any problematic characters in the replacement text
escapeCharacter() #Takes 2 arguments, the character to escape and the text to escape it from