ERIK

HAZZARD

CTO and Co-Founder, Five

posts

Replace a String in Multiple Files in Linux Using Grep and Sed

This is the quickest way I've found to search for and replace every occurrence of a string in multiple files in linux.

grep -rl matchstring somedir/ | xargs sed -i 's/string1/string2/g'
example:
grep -rl 'windows' ./ | xargs sed -i 's/windows/linux/g'

Sunday, April 25 2010 | 3 min read

Removing ^M characters on ubuntu in VIM

Remove ^M characters in VIM by replacing \r with nothing. ^M is really \r. Use :%s/\r//g

Friday, November 06 2009 | 2 min read

ATI / NVidia Dual monitors with Ubuntu 8.04

Set up dual monitors in Ubuntu 8.04 for both ATI and NVidia based graphics cards without configuring xorg.conf or manually editing any other files. This should work for most ait or nvidia based dual monitor setups with Ubuntu 8.04 Hardy Heron. Note: This is a bit outdated, newer versions of Ubuntu support this out of the box

Monday, July 21 2008 | 10 min read