#! /bin/bash Imagine you have a large file ( /etc/sysconfig/selinux ) and you want to replace all the words "SELINUX=enforcing" with "#SELINUX=enforcing". Here is the script. sed -i 's/SELINUX=enforcing/#SELINUX=enforcing/g' /etc/sysconfig/selinux