If you want to remove blank lines (using vi):
:g/^$/d
For commented lines (using vi):
:g/^#/d
And for lines where windows editor put ^M and you want to remove (using vi):
:%s/^V^M//g
Note that we cannot just type the accent ^ , instead we must use ^V and then type M, so the final command will look like this (using vi):
:%s/^M//g
The same as above can be reached using egrep:
egrep -v "^#|^$" squid.original > squid.conf
And the same using grep command:
grep -v ^["#"] /etc/squid3/squid.original > /etc/squid3/squid.conf
:g/^$/d
For commented lines (using vi):
:g/^#/d
And for lines where windows editor put ^M and you want to remove (using vi):
:%s/^V^M//g
Note that we cannot just type the accent ^ , instead we must use ^V and then type M, so the final command will look like this (using vi):
:%s/^M//g
The same as above can be reached using egrep:
egrep -v "^#|^$" squid.original > squid.conf
And the same using grep command:
grep -v ^["#"] /etc/squid3/squid.original > /etc/squid3/squid.conf
Comments
Post a Comment