Linux quicktip - find and replace from the command line using sed
If you’ve ever had to modify files on your Linux system and simply change a word or two, there’s a fast and simple way to do this using sed.
Say you want to change your sources.list file to go from Ubuntu 6.06 (Dapper) to 6.10 (Edgy). You can do this with a one line command using sed.
sudo sed -i ’s/dapper/edgy/g’ /etc/apt/sources.list
You’ve just replaced all of your instances of the word ‘dapper‘ with ‘edgy‘.
You can also combine the sed command with the find command for a pretty powerful find and replace.