sed csv remove conditionally
Hello,
I have many csv file, but I would like to delete lines with some values in a column conditionally.
My example look like this,
ex1e, ex2g, ex39, pasg, ssg, mrlc, pc, kb, coop
-112, -53, -177, 64, 62, 71, 1, 487, 20
-101, -61, -53, 0, 32767, 51, 0, 239, 30
-57, -95, -215, 144, 174, 42, 0, 316, 12
23, 47, 32, 42, -300, 71, 0, 112, -23
11, 45, 44, -20, 300, 51, 1, 279, 32
31, 52, 63, 74, 301, 40, 1, 28, -2
82, 35, 23, 77, -299, 51, 1, 0, -1
What I want to do is to look at the field, ssg (column5), then find values only greater than or equal to -300 and less than or equal to 300. So, the result should be look like this.
ex1e, ex2g, ex39, pasg, ssg, mrlc, pc, kb, coop
-112, -53, -177, 64, 62, 71, 1, 487, 20
-57, -95, -215, 144, 174, 42, 0, 316, 12
23, 47, 32, 42, -300, 71, 0, 112, -23
11, 45, 44, -20, 300, 51, 1, 279, 32
82, 35, 23, 77, -299, 51, 1, 0, -1
I tried to use sed below, but I got stuck after that.
sed '/^\([^,]*,\)\{6\}300,......
Please help me.
Jae