strip out the # on the CLI text editor

Hello guys,

how can i strip out the # command in CLI on openSUSE? or the exact way of this command in ubuntu

sh -c “grep -v -e ‘^#’ /etc/squid/squid.conf.backup | cat -s > /etc/squid/squid.conf”


do you mean the “#” at the command prompt?

To do that, you must edit the PS1 system variable, with the ‘export’ command (see ‘man export’).



On 03/07/2011 04:36 PM, samhela wrote:
> how can i strip out the # command in CLI on openSUSE?

if you don’t log in as root it won’t be there, right?

actually, i’m not at all sure what you are attempting to
accomplish…maybe you could clarify…

[NNTP posted w/openSUSE 11.3, KDE4.5.5, Thunderbird3.0.11, nVidia
173.14.28 3D, Athlon 64 3000+]
“It is far easier to read, understand and follow the instructions than
to undo the problems caused by not.” DD 23 Jan 11

I think this is what you are looking for

sed -i /#/d /etc/squid/squid.conf"

This command deletes all lines with a #. Backup your /etc/squid/squid.conf file before attempting.


Sorry, missed the ^ in the original post

sed -i /^#/d /etc/squid/squid.conf


yea tnx i was searching for that, but it works fine with post 15 too, is their any means to do not delete the comments but when ever u don’t want see the comments then some command i mean other than deleting just hiding the comments.

Try this

cat /etc/squid/squid.conf | sed /^#/d | less

This will strip away the # and let you view the file with less.
This will not remove the # from the actual file.