shell 格式化输出nginx的编译参数

前端之家收集整理的这篇文章主要介绍了shell 格式化输出nginx的编译参数前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

命令

Nginx-V>Nginx.txt
cat-nNginx.txt|sed-n'5,18p'|awk'{$1="";print$0}'
|sed's/^[]*//g'|tr'\n'','|sed-n's/,//gp'|tr"""\n"

结果

configure
arguments:
--user=Nginx
--group=Nginx
--prefix=/usr/share/Nginx
--sbin-path=/usr/sbin/Nginx
--conf-path=/etc/Nginx/Nginx.conf
--error-log-path=/var/log/Nginx/error.log
--http-log-path=/var/log/Nginx/access.log
--http-client-body-temp-path=/var/lib/Nginx/tmp/client_body
--http-proxy-temp-path=/var/lib/Nginx/tmp/proxy
--http-fastcgi-temp-path=/var/lib/Nginx/tmp/fastcgi
--http-uwsgi-temp-path=/var/lib/Nginx/tmp/uwsgi
--http-scgi-temp-path=/var/lib/Nginx/tmp/scgi
--pid-path=/var/run/Nginx.pid
--lock-path=/var/lock/subsys/Nginx
--with-http_ssl_module
--with-http_spdy_module
--with-http_v2_module
--with-http_realip_module
--with-http_addition_module
--with-http_xslt_module
--with-http_image_filter_module
--with-http_sub_module
--with-http_dav_module
--with-http_flv_module
--with-http_gzip_static_module
--with-http_secure_link_module
--with-http_degradation_module
--with-http_stub_status_module
--with-debug
--with-http_sysguard_module
--with-http_upstream_check_module
--with-http_lua_module
--with-http_dyups_module
--with-luajit-lib=/usr/lib
--with-luajit-inc=/usr/include/luajit-2.0

解释:

awk'{$1="";print$0}'

输出第2列至最后一列(即排除第一列)

sed's/^[]*//g'

去掉行首的空格

tr'\n'',//gp'

去掉换行符,先把换行符替换成逗号(或者#¥%&等),然后再讲逗号删除

原文链接:https://www.f2er.com/bash/390515.html

猜你在找的Bash相关文章