如下
➜ nginx nginx -V
nginx version: nginxx/x.x.x
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx/nginx.pid --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fcgi --with-http_stub_status_module --with-http_sub_module --with-http_spdy_module
现在想把configure arguments一段输出打印成:
--prefix=/usr
--sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
...
..
.
主要是为了grep起来方便,之前见过类似命令,貌似用到awk还是sed,求大神解答!
1
lhbc 2015-05-19 13:49:22 +08:00 via Android 1
sed 's/\s+/\n/g'
|
2
BOYPT 2015-05-19 13:54:40 +08:00 2
nginx -V 2>&1 | sed 's/ /\n/g'
nginx version: nginx/1.6.2 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/nginx.pid --lock-path=/run/nginx.lock --http-client-body-temp-path=/var/spool/nginx/client_body_temp --http-proxy-temp-path=/var/spool/nginx/proxy_temp --http-fastcgi-temp-path=/var/spool/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/spool/nginx/uwsgi_temp --http-scgi-temp-path=/var/spool/nginxscgi_temp --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --user=http --group=http --with-debug --with-ipv6 --with-imap --with-imap_ssl_module --with-http_ssl_module --with-http_stub_status_module --with-http_dav_module --with-http_gzip_static_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_sub_module --with-http_random_index_module --with-http_secure_link_module --with-http_perl_module --with-http_degradation_module --with-http_geoip_module --with-http_gunzip_module --with-http_spdy_module --add-module=../ngx_cachepurge --add-module=../ngx_echo --add-module=../ngx_headersmore --add-module=../ngx_authpam --add-module=../sysguard |
3
endoffight OP 十分感谢~
|
4
lhbc 2015-05-19 14:40:31 +08:00
忘了,+ 也要用 \
sed 's/\s\+/\n/g' |