Попробуйте это
grep -v "^-" test.txt | tr -s " " ',' | sed -e s/:/,/3g -e '0,/data/ s/data/appnbr,request,tasknbr,appctx,username/'
Я согласен с комментарием Влада к текущему ответу. Безопасный способ просто проверить синтаксис — использовать опцию отладки .
Изman logrotate
:
-d, --debug
Turns on debug mode and implies -v. In
debug mode, no changes will be made to the
logs or to the logrotate state file.
Пример на моей машине:
$ logrotate -d /etc/logrotate.d/httpd
reading config file /etc/logrotate.d/httpd
Handling 1 logs
rotating pattern: /var/log/httpd/*_log 5242880 bytes (10 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/httpd/access_log
log does not need rotating
considering log /var/log/httpd/error_log
log does not need rotating
not running postrotate script, since no logs were rotated
Конечно, чтобы на самом деле увидеть что происходит, -df
или -vf
вызовут вращение, что позволит провести дальнейший анализ.