Welcome to Terminal Tips, a series where we’ll be sharing some shortcuts and tricks we’ve picked up along the way as we use the command line. Today’s post covers a command that is more frequently associated with a text editor than the command line: “Find and Replace”.  If you need to do a find and replace on a file, especially a large file, it becomes cumbersome to do so in a text editor. Github’s new editor, Atom, won’t let you open files larger than 2MB as of the time of this post.

So let’s say you have a CSV file with a couple hundred thousand rows and you want to change any occurrences of the string ‘old’ to the string ‘new’. You could do this using a word processor or an editor, but it would likely crash before you even got the file open, or it would take forever to actually perform the find and replace. What you need is something that gets the job done without all the overhead of an editor. This is where sed comes in.  A quick look at the manual for sed tells us:

The sed utility reads the specified files, or the standard input if no files are specified, modifying the input as specified by a list of commands.

(If you want to read more, open up the Terminal and run the command ‘man sed’ without the quotes)

So now that we know what we’re working with, let’s start to construct our command.

From the man page, the -i flag edits files in place, allowing you to specify a backup. If you’re not concerned about running out of disk space this isn’t absolutely necessary, so we’ll just leave that blank for now.  Our command now looks like:

sed -i ''

Now we actually have to specify the text we want to find and replace. If we want to replace the word old with the word new, we need to construct a suitable expression to tell sed what it is looking for:


From the manual, the -e flag will “Append the editing commands specified by the command argument to the list of commands.” Sounds perfect.  Our command now looks like this:

sed -i '' -e 's/old/new/g'

Now all we have to is specify the path to the file you want to run the command on.  If we had a CSV file called list.csv in our current directory, we could just append that to the command. Now we have:

sed -i '' -e 's/old/new/g' list.csv

When we run this command and go look in the file, we can see that all instances of ‘old’ have been replaced with ‘new’ and you’ve learned a new shell command!



Extra Credit

What if you wanted to find and replace a URL? You can’t use a slash as the seperator character, because there will most likely be slashes in your URL. sed uses whatever follows the ‘s’ in the regular expression as the seperator. So, for example, we could use a comma as a seperator.

sed -i '' -e 's,http://www.oldurl.com,http://www.newurl.com,g'

We can really use any symbols we want.

sed -i '' -e 's#http://www.oldurl.com#http://www.newurl.com#g'


Keep an eye on the blog in the coming weeks for more Terminal Tricks!


I had a little down time on my hands so put together a compilation of some compositing and vfx we’ve done here at doejo as well as an updated logo animation with the help of our summer intern Alex Berkowitz! Check check check it out.


To help introduce everyone in our office to the outside world we thought it would be a fun idea to interview each other and post them onto our blog… hopefully this isn’t the worst interview ever, but it was a first try so hopefully the others to follow get a little better. I interviewed one of our premier developers Bryan Paronto, covering his education to his favorite beers. Enjoy

Processed with VSCOcam with e7 preset


Reelagram on Techcrunch!

Techcrunch, a leading source for the latest technology news, published an article this morning on a Doejo endevour called Reelagram. Check it out!

Reelagram is the brainchild of Doejo co-founders Phil Tadros and Darren Marshall. Never ones to forget the most prized objects of their childhood, Darren, Phil and several members of the Doejo team found a way to customize a View-Master to show pictures of all your favorite selfies, lunch pics, and nature shots!

Order your own Reelagram HERE

Matt Lissner

techweekchicago2014 I had a chance to head into the city proper and peruse all the budding and established companies competing down at Techweek Chicago 2014. I also ran into a fellow Doejo’r who was exhibiting his own idea ScienceBox. Overall I thought it was a very entertaining day full of great talks and great people working hard to get started. A few notable mentions from what I saw. Your interests may very, to each their own. :)


While not presenting per se, I did run into Josh from bucketfeet. Very cool idea. Think like threadless for shoes. I’m down for any shoes with out laces so I was sold right off the bat.

Taxi Magic

I suppose I have been under a rock but taxi magic seems to be the rebuttal to uber.com and the taxi industry’s awful phone dispatch service that we have all became painfully accustomed to over the years. Nice to know the taxi companies have decided to leave the 90′s telephone cab dispatch service and attempt an entrance into 2014. Is there a payphone nearby? I need change for a dollar.

Seat Side Service

Maybe not a new and groundbreaking idea, it is definitely a super convenient. They boast a delivery to your seat at the stadium within 10minutes of your order. They have been around a few years and many minor league baseball stadiums. I also found out that the MLB have a mandate to supply good serviceable wifi at all their stadiums by 2015. As a wriglyville resident I can say I’m very much looking forward to decent reception awhile at the game.


One of the most understated tables at the event. I was really impressed by the thought put into this service. They seamlessly layer affiliate links into videos in a way that makes sense. Like that turntable in the background of the last Fargo episode but can’t figure out what its called and where to buy it? Like the dress in that movie but have no idea where to start looking for the designer? Clictivate will add clickable regions to items in the video that link straight to the retailer. They even provide heat mapping to show which items people are clicking for. I want to see this layer as a way to watch netflix for free. Who’s with me?

Science Box

Doejo’s own Faraj Khasib was out promoting his own company called ScienceBox. Science box is promising in that it is out to help cut R&D down in the pharma industry by building a platform to facilitate in the testing process and sharing those results to help others fail faster. Anything to help bring down the cost of medicine and speed up the time to create better cures is definitely worthy of a deeper look.




Garrett Galayda

Creative Director