Search and replace with Vim and Sed
Using search and replace is a great way to save time when editing large files in Linux. Becoming proficient with this task will increase your efficiency and will reduce your time spent doing tedious and error-prone file edits by hand. For the sake of this tutorial, I’m going to use a copy of the /etc/apt/sources.list file to illustrate some of the changes that we can make. From your users home directory copy the sources.list file to your home directory. Or you can copy the contents of my list, shown a bit further down, into a new file. This tutorial assumes that you are comfortable reading and writing files with vim. If not open a terminal and type: vimtutor sudo cp /etc/apt/sources.list /home/luke/sources.txt sudo chown $USER:$USER sources.txt Here are the contents of my sources.list file. cat sources.txt # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ xenial main res