2014-10-16 29 views
0

我有以下命令:如何使用貓在管道

httpd.conf | grep AuthUserFile | cut -d" " -f4 | sed -e 's|["'\'']||g' 

的這個輸出是:

/etc/httpd/secure/htpasswd.training 

我所做的:

httpd.conf | grep AuthUserFile | cut -d" " -f4 | sed -e 's|["'\'']||g'| cat 

然而,這只是返回:

/etc/httpd/secure/htpasswd.training 

我想捕捉文件的內容。我該怎麼做呢?

+0

好(對不起),但後來添加「一刀切」和「貓」的標籤 – smartmeta 2014-10-16 13:15:34

回答

0

將管道傳遞到xargs cat將打印文件,將stdin作爲參數傳遞給cat

或者嘗試:cat $(some command printing a filename)

0

你可以嘗試用反引號作爲參數周圍您最初的命令cat,像這樣:

cat `httpd.conf | grep AuthUserFile | cut -d" " -f4 | sed -e 's|["'\'']||g'`