Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 6 years ago.
I am trying to use grep like I am used to from Linux, with all its amazing features and all the power from RegEx,... but on Mac OS X it's not working as I expect.
If I use "-P" (Perl Regex) it gives me the "usage" (--help) output. In there we find the "-P" parameter in the list of parameters "-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ"... Still not working.
Another example is the asterisk or the plus sign. I am trying this http://wiki.bash-hackers.org/howto/conffile
To check a config file for inappropriate content that instruction uses:
if egrep -q -v '^#|^[^ ]*=[^;]*' "$configfile"; then
echo "Config file is unclean, cleaning it..." >&2
# filter the original to a new file
egrep '^#|^[^ ]*=[^;&]*' "$configfile" > "$configfile_secured"
configfile="$configfile_secured"
fi
And it does not work on lines like this:
DATABASE=some_database; ls -la
What am I doing wrong? Cause all of this works just fine on Linux machines.