我必须打印与文件中的确切单词匹配的行号。所以我使用grep -w命令,但我得到了多个匹配。
例如
grep -nw "\babc\b" /tmp/test.json
272:{"name": "abc", "imagen": "Application1.png"},
273:{"name": "abc-bcdgroup-deSSL", "imagen": "Application1.png"},
274:{"name": "abc-fb-na", "imagen": "Application1.png"},
275:{"name": "abc-gf3-bmw-comSSL", "imagen": "Application1.png"},
如果我搜索abc,那么它应该只打印
272:{"name": "abc", "imagen": "Application1.png"}
对此有何建议?
答案 0 :(得分:1)
尝试以下命令:
grep -nw "\"abc\"" /tmp/test.json
答案 1 :(得分:0)
尝试使用开始和结束锚点
grep -nw "^abc$" /tmp/test.json
答案 2 :(得分:0)
您是否尝试过 var fs = require( 'fs' );
var app = require('express')();
var https = require('https');
var server = https.createServer({
key: fs.readFileSync('C:/ssl/ia.key'),
cert: fs.readFileSync('C:/ssl/ia.crt'),
requestCert: false,
rejectUnauthorized: false
},app);
server.listen(8888);
?
-P