For my memory: Grep all lines without comments

This little script (I call it “strip”) takes “file” as first parameter. It will move file to backup, grep all lines that are no comments and paste them into original file. Makes squid.conf et al so much easier to handle, and you still have all the comments in the backup file

#! /bin/bash
mv $1 $1.bak
grep “^[^#;]” $1.bak > $1

I tested this on my raspi, with a pretty 

root@raspi:~# cat configtest.conf.bak
blabla
#comment
blabla
;comment
root@raspi:~# bash ./strip configtest.conf
root@raspi:~# ls
configtest.conf  configtest.conf.bak  strip
root@raspi:~# cat configtest.conf
blabla
blabla
root@raspi:~#