adamchilcott icon

sanitiseConfiguration.sh

adamchilcott | PRO | 03/09/18 10:52:56 AM UTC | 0 ⭐ | 949 👁️ | Never ⏰ | []
Bash |

570 B

|

None

|

0 👍

/

0 👎

#!/usr/bin/env bash
 
##############################
# Configuration File Sanitiser
##############################
 
sed -ri -e '/[[:blank:]]*#.*$/d ;/^[[:blank:]]*$/d ;s/[[:blank:]]*$// ;s/^[[:blank:]]*// ;s/[[:blank:]]*=[[:blank:]]*/=/' <file> && sort -fuo <file>
 
#############
# START NOTES
#############
 
## in config files that have the form of key = value and uses # for comments, 
## this little sed removes trailing and preceding whitespaces, 
## deletes empty lines and removes comment lines.After, it sorts the file : 
 
###########
# END NOTES
###########

Comments