Skip to content

Instantly share code, notes, and snippets.

@vpnwall-services
Last active January 9, 2019 14:21
Show Gist options
  • Save vpnwall-services/380a5a54595c81aec47fddfd9acc2aa6 to your computer and use it in GitHub Desktop.
Save vpnwall-services/380a5a54595c81aec47fddfd9acc2aa6 to your computer and use it in GitHub Desktop.
[Find non commented lines] Print lines that does not contain # or ; #linux #grep #comment #search
#!/bin/bash
if [ -z "$1" ]
then
echo -e "\nInfo : find non commented lines in file"
echo -e "and put results in /tmp/uncommented-filename"
echo -e "Usage : ./find-non-commented.sh <file to search>\n"
else
echo -e "\nSearching $1 file for non commented lines"
FILENAME=$(basename -- "$1")
#grep -v "^\s*[#\;]\|^\s*$" $1 > /tmp/uncommented-$FILENAME
grep -v '^\;\|^$' fichier > /tmp/uncommented-fichier.php
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment