I've an egrep
statement(as a part of a script) purpose of which is to check for any characters other than ASCII characters 0-9, a-z, A-Z, space, enter, newline
. Also if text is enclosed in []
, it can contain 0-9, a-z, A-Z, _, =
which works perfectly as I expect on a RHEL box:
uname -a
Linux labeir1 2.6.18-371.el5 #1 SMP Thu Sep 5 21:21:44 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/redhat\-release
Red Hat Enterprise Linux Server release 5.10 (Tikanga)
The egrep
statement:
egrep -v "^[ ]*([a-zA-Z0-9\t\n\v\f\r ]*|\[{1}[_a-zA-Z0-9\t\n\v\f\r ]*(=[a-zA-Z0-9\t\n\v\f\r ]*)?\]{1})[ ]*$" file1
File1:
[FEATURE_ID=2]
[FEATURE_REV=1]
[NO_OF_BYTES=18]
001203658080400160b9d0ae45000080
[CRC]
c068
Output:
Nothing, as the patterns of file1 matches
But when I use this on a SunOS system, it fails to behave the same way:
uname -a
SunOS prodOTA1 5.9 Generic_118558-38 sun4us sparc FJSV,GPUZC-M
Output on SUNOS:
[FEATURE_ID=2]
[FEATURE_REV=1]
[NO_OF_BYTES=18]
[CRC]
Can you please help to use the exact equivalent of egrep -v "^[ ]*([a-zA-Z0-9\t\n\v\f\r ]*|\[{1}[_a-zA-Z0-9\t\n\v\f\r ]*(=[a-zA-Z0-9\t\n\v\f\r ]*)?\]{1})[ ]*$"
in SunOS, so that I get the exact output as in RHEL box.