sed匹配JSON数据中的数字
{"list":[{"fs_id":4176732013,"path":"\/apps\/zjhui\/bash","ctime":1389845838,"mtime":1389845838,"block_list":"[\"286dc423e71186936c39e3507d2d0cf1\"]","size":2076,"isdir":0,"ifhassubdir":0,"filenum":0}],"request_id":2785468470}
有这么一串,我想利用sed将"isdir":0这里的0单独取出来。利用如下命令:
sed -n 's/"isdir":\(.*\)/\1/p'
发现匹配出来的是:
{"list":[{"fs_id":4176732013,"path":"\/apps\/zjhui\/bash","ctime":1389845838,"mtime":1389845838,"block_list":"[\"286dc423e71186936c39e3507d2d0cf1\"]","size":2076,0,"ifhassubdir":0,"filenum":0}],"request_id":2785468470}
isdir没了。而我想要的是isdir后面那个0(这个数字也有可能是1)
求解!
九尾小狐狸
10 years, 6 months ago