user3809938
user3809938

Reputation: 1304

How to use cat in a pipe

I have the following command:

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

the output of this is:

/etc/httpd/secure/htpasswd.training

I did:

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

However this just returned:

/etc/httpd/secure/htpasswd.training

I want to cat the contents of the file. How do I do this?

Upvotes: 10

Views: 24251

Answers (2)

Flic
Flic

Reputation: 751

You could try surrounding your initial command with backticks as the argument to cat, like so:

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

Upvotes: 0

lynn
lynn

Reputation: 10784

Piping to xargs cat will pass stdin as an argument to cat, printing the file.

Alternatively try: cat $( some command printing a filename ).

Upvotes: 12

Related Questions