Ubuntu 16.04
Баш 4.4.0
Я использую grep
для поиска слова «ошибка» в файле json, который является лог-файлом. Как можно добавить пустую строку после каждого экземпляра?
Моя команда: grep error "${wDir}"/"${client}"/logs/server.json >> "$eLog"
вывод:
{"name":"XXX_XXX","hostname":"xxx.xx.xxx","pid":5193,"level":30,"fbresponse":{"error":{"message":"(#200) User does not ....."}}}
{"name":"XXX_XXX","hostname":"xxx.xx.xxx","pid":5193,"level":30,"fbresponseraw":{"error":{"message":"(#200) User does not ..."}}}
{"name":"XXX_XXX","hostname":"xxx.xx.xxx","pid":5193,"level":30,"fbresponse":{"error":{"message":"(#200) User does not ....."}}}
{"name":"XXX_XXX","hostname":"xxx.xx.xxx","pid":5193,"level":30,"fbresponseraw":{"error":{"message":"(#200) User does not ..."}}}
Желаемый вывод:
{"name":"XXX_XXX","hostname":"xxx.xx.xxx","pid":5193,"level":30,"fbresponse":{"error":{"message":"(#200) User does not ....."}}}
{"name":"XXX_XXX","hostname":"xxx.xx.xxx","pid":5193,"level":30,"fbresponseraw":{"error":{"message":"(#200) User does not ..."}}}
{"name":"XXX_XXX","hostname":"xxx.xx.xxx","pid":5193,"level":30,"fbresponse":{"error":{"message":"(#200) User does not ....."}}}
{"name":"XXX_XXX","hostname":"xxx.xx.xxx","pid":5193,"level":30,"fbresponseraw":{"error":{"message":"(#200) User does not ..."}}}