Using GREP and SED to replace a string in all files in a directory

Over the years, there have been many times when I’ve needed to replace a string in thousands of files.  Usually this comes from a change in some sort of output standard and we’re converting historical data to match, or worse, a typo was found in a script after output was generated.   This little command has saved me many times: cd /to/my/dir grep -r “some_string” * | xargs sed -i...

Introduction

Over the years I have researched many data topics, stumbled on many of those “undocumented features” in technology solutions, and written many scripts to recreate issues and prove out solutions. Like most experienced developers, Google is your best friend, and you hope that someone else has solved a particular problem, or has that one nugget of insight you need. I’m excited to have the opportunity to begin contributing back to the knowledge community. While no one is an expert on everything, I do hope you find my posts informative and thought-provoking. I’m a firm believer that there’s never just 1 solution to a problem, so I welcome constructive feedback and input. It’s through collaboration that we’re able to enhance the tools and methods that we collectively rely upon as the leaders in our data technology...