命令
1
2
3
|
nginx -V > nginx.txt
cat -n nginx.txt | sed -n
'5,18p'
| awk
'{$1="";print $0}'
| sed
's/^[ ]*//g'
| tr
'\n'
','
| sed -n
's/,//gp'
| tr
" "
"\n"
|
结果
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
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
|
解释:
1
|
awk
'{$1="";print $0}'
|
输出第2列至最后一列(即排除第一列)
1
|
sed
's/^[ ]*//g'
|
去掉行首的空格
1
|
tr
'\n'
','
| sed -n
's/,//gp'
|
去掉换行符,先把换行符替换成逗号(或者#¥%&等),然后再讲逗号删除
本文转自Tenderrain 51CTO博客,原文链接:http://blog.51cto.com/tenderrain/1967076,如需转载请自行联系原作者