用grep -i 命令提取文件中关键字所在行时,当关键字为负数时报错。
匹配的关键词为正数时是OK的,
$ grep -i "1.50513e-01," file.txt
cd3("cd3","coefficienct", 1.50513e-01, -4, 4);
但匹配负数时报错了,
$ grep -i "-2.33102e-01," file.txt
grep: invalid option -- '.'
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
请问是什么原因,我应该怎么操作呢,因为我要写在shell脚本循环里,匹配的关键词有正有负,求救大神。
https://blog.csdn.net/Greahow/article/details/80300913
$ grep -i "^-6." counttime.csv
-6.3232
-6.13313
-6.84773
-6.58793
-6.0666
-6.94433
-6.91647
"^”匹配行首