在bash中缩进输出的特定部分

我有以下bash脚本,找到所有error.logs给他们一个标题,然后在它下面的5行尾巴..
#!/bin/bash
for ERR in `find -name "error.log"`;
do
    echo -e "---- LOG: $ERR ----";
    tail -n 5 $ERR;
done;

我希望它的输出如下:

---- LOG: foo/error.log ----
    [error ....]
    [error ....]
---- LOG: foo/error.log ----
    [error ....]
    [error ....]
---- LOG: foo/error.log ----
    [error ....]
    [error ....]

其中tail’d部分缩进了一些字符(例如4或任何制表符)

我如何缩进特定部分输出

通过sed管道你的tail命令:
tail -n 5 $ERR | sed -e 's/^/    /'

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...