grep and regular expressions :
I wrote a simple korn shell where I am trying to filter all the good record layouts of a file to only leave the bad ones to look at. That file is hudge. Aside from '# comments' and 'var=ssss', all record should follow a specific record layout, with comma seperated fields. Some fields can have any value, others a choice of 4-5 different values.
First I tried running the script but noticed at the end that some grep didn't filter out some cases. So I tried them one by one until i got to the grep4 creation. It doesn't filter out the case it looks for.
grep -v -i '^#' filea.txt >grep1.tmp
grep -v -i "=" grep1.tmp >grep2.tmp
grep -v -i "^*.aaa.bbb.ccc,*,??,infrastructure,slow,__NONE__,__NONE__" grep2.tmp >grep3.tmp
grep -v -i "^*.aaa.bbb.ccc,*,??,infrastructure,fast,__NONE__,__NONE__" grep3.tmp >grep4.tmp
grep -v -i "^*.aaa.bbb.ccc,*,??,infrastructure,hybrid,__NONE__,__NONE__" grep4.tmp >grep5.tmp
grep -v -i "^*.aaa.bbb.ccc,*,??,??,fast,__NONE__,__NONE__" grep5.tmp >grep6.tmp
grep -v -i "^*.aaa.bbb.ccc,*,??,??,slow,__NONE__,__NONE__" grep6.tmp >grep7.tmp
grep -v -i "^*.aaa.bbb.ccc,*,??,??,hybrid,__NONE__,__NONE__" grep7.tmp >grep8.tmp
cat grep8.tmp | more
rm grep?.tmp
grep3.tmp file
...
usbisbb007zfs36.aaa.bbb.ccc,uslastm007zfsx6-zfs-gaw,us,infrastructure,fast,__NONE__,__NONE__
uslaqlr007zfs36.aaa.bbb.ccc,uslastm007zfsx6-zfs-gaw,us,infrastructure,fast,__NONE__,__NONE__
uslaqlr017zfs36.aaa.bbb.ccc,uslastm007zfsx6-zfs-gaw,us,infrastructure,fast,__NONE__,__NONE__
ussvsbb017zfs36.aaa.bbb.ccc,uslastm007zfsx6-zfs-gaw,us,infrastructure,fast,__NONE__,__NONE__
>grep -v -i "^*.aaa.bbb.ccc,*,??,infrastructure,fast,__NONE__,__NONE__" grep3.tmp | more
uslastm007zfsx6.aaa.bbb.ccc,uslastm007zfsx6-zfs-gaw,us,infrastructure,fast,__NONE__,__NONE__
uslasmn007zfsx6.aaa.bbb.ccc,uslastm007zfsx6-zfs-gaw,us,infrastructure,fast,__NONE__,__NONE__
uslassh007zfs36.aaa.bbb.ccc,uslastm007zfsx6-zfs-gaw,us,infrastructure,fast,__NONE__,__NONE__
...
Are some of my grep characters special reserved ones ?
Why doesn't it work ?