Try to grep out varnish version does not work
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I try to read the varnish version from a Linux Command line, but the following does not work:
varnishd -V | grep -P '(?<=varnish-)[0-9.]+' -o
This always returns this
varnishd (varnish-3.0.3 revision 9e6a70f)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2011 Varnish Software AS
instead of just this
3.0.3
Any hints on what I do wrong?
Thanks
linux grep varnish
add a comment |Â
up vote
0
down vote
favorite
I try to read the varnish version from a Linux Command line, but the following does not work:
varnishd -V | grep -P '(?<=varnish-)[0-9.]+' -o
This always returns this
varnishd (varnish-3.0.3 revision 9e6a70f)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2011 Varnish Software AS
instead of just this
3.0.3
Any hints on what I do wrong?
Thanks
linux grep varnish
1
If you just want the digits in decimal form, you will need something like grep -o '[0-9].[0.9].[0-9]'
â Raman Sailopal
Oct 9 '17 at 12:43
But this works: "httpd -version | grep -P '(?<=Apache/)[0-9.]+' -o". So why should this not work on the varnish version command?
â Klaus Hörmann-Engl
Oct 9 '17 at 12:46
1
Perhapsvarnishd -V
writes tostderr
notstdout
? Try appending2>&1
â steeldriver
Oct 9 '17 at 12:47
@steeldriver You were absolutely right. I needed to redirect the stderr to the stdout. Now it works like a charm: 'varnishd -V 2>&1 | grep -P '(?<=varnish-)[0-9.]+' -o' If you make an answer out of it, I will mark it as solved.
â Klaus Hörmann-Engl
Oct 9 '17 at 12:53
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I try to read the varnish version from a Linux Command line, but the following does not work:
varnishd -V | grep -P '(?<=varnish-)[0-9.]+' -o
This always returns this
varnishd (varnish-3.0.3 revision 9e6a70f)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2011 Varnish Software AS
instead of just this
3.0.3
Any hints on what I do wrong?
Thanks
linux grep varnish
I try to read the varnish version from a Linux Command line, but the following does not work:
varnishd -V | grep -P '(?<=varnish-)[0-9.]+' -o
This always returns this
varnishd (varnish-3.0.3 revision 9e6a70f)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2011 Varnish Software AS
instead of just this
3.0.3
Any hints on what I do wrong?
Thanks
linux grep varnish
linux grep varnish
asked Oct 9 '17 at 12:33
Klaus Hörmann-Engl
31
31
1
If you just want the digits in decimal form, you will need something like grep -o '[0-9].[0.9].[0-9]'
â Raman Sailopal
Oct 9 '17 at 12:43
But this works: "httpd -version | grep -P '(?<=Apache/)[0-9.]+' -o". So why should this not work on the varnish version command?
â Klaus Hörmann-Engl
Oct 9 '17 at 12:46
1
Perhapsvarnishd -V
writes tostderr
notstdout
? Try appending2>&1
â steeldriver
Oct 9 '17 at 12:47
@steeldriver You were absolutely right. I needed to redirect the stderr to the stdout. Now it works like a charm: 'varnishd -V 2>&1 | grep -P '(?<=varnish-)[0-9.]+' -o' If you make an answer out of it, I will mark it as solved.
â Klaus Hörmann-Engl
Oct 9 '17 at 12:53
add a comment |Â
1
If you just want the digits in decimal form, you will need something like grep -o '[0-9].[0.9].[0-9]'
â Raman Sailopal
Oct 9 '17 at 12:43
But this works: "httpd -version | grep -P '(?<=Apache/)[0-9.]+' -o". So why should this not work on the varnish version command?
â Klaus Hörmann-Engl
Oct 9 '17 at 12:46
1
Perhapsvarnishd -V
writes tostderr
notstdout
? Try appending2>&1
â steeldriver
Oct 9 '17 at 12:47
@steeldriver You were absolutely right. I needed to redirect the stderr to the stdout. Now it works like a charm: 'varnishd -V 2>&1 | grep -P '(?<=varnish-)[0-9.]+' -o' If you make an answer out of it, I will mark it as solved.
â Klaus Hörmann-Engl
Oct 9 '17 at 12:53
1
1
If you just want the digits in decimal form, you will need something like grep -o '[0-9].[0.9].[0-9]'
â Raman Sailopal
Oct 9 '17 at 12:43
If you just want the digits in decimal form, you will need something like grep -o '[0-9].[0.9].[0-9]'
â Raman Sailopal
Oct 9 '17 at 12:43
But this works: "httpd -version | grep -P '(?<=Apache/)[0-9.]+' -o". So why should this not work on the varnish version command?
â Klaus Hörmann-Engl
Oct 9 '17 at 12:46
But this works: "httpd -version | grep -P '(?<=Apache/)[0-9.]+' -o". So why should this not work on the varnish version command?
â Klaus Hörmann-Engl
Oct 9 '17 at 12:46
1
1
Perhaps
varnishd -V
writes to stderr
not stdout
? Try appending 2>&1
â steeldriver
Oct 9 '17 at 12:47
Perhaps
varnishd -V
writes to stderr
not stdout
? Try appending 2>&1
â steeldriver
Oct 9 '17 at 12:47
@steeldriver You were absolutely right. I needed to redirect the stderr to the stdout. Now it works like a charm: 'varnishd -V 2>&1 | grep -P '(?<=varnish-)[0-9.]+' -o' If you make an answer out of it, I will mark it as solved.
â Klaus Hörmann-Engl
Oct 9 '17 at 12:53
@steeldriver You were absolutely right. I needed to redirect the stderr to the stdout. Now it works like a charm: 'varnishd -V 2>&1 | grep -P '(?<=varnish-)[0-9.]+' -o' If you make an answer out of it, I will mark it as solved.
â Klaus Hörmann-Engl
Oct 9 '17 at 12:53
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Apparently varnishd -V
writes to stderr
not stdout
. In order to pipe the result into grep
, you will need to redirect the stream e.g.
varnishd -V 2>&1 | grep -P '(?<=varnish-)[0-9.]+' -o
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Apparently varnishd -V
writes to stderr
not stdout
. In order to pipe the result into grep
, you will need to redirect the stream e.g.
varnishd -V 2>&1 | grep -P '(?<=varnish-)[0-9.]+' -o
add a comment |Â
up vote
0
down vote
accepted
Apparently varnishd -V
writes to stderr
not stdout
. In order to pipe the result into grep
, you will need to redirect the stream e.g.
varnishd -V 2>&1 | grep -P '(?<=varnish-)[0-9.]+' -o
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Apparently varnishd -V
writes to stderr
not stdout
. In order to pipe the result into grep
, you will need to redirect the stream e.g.
varnishd -V 2>&1 | grep -P '(?<=varnish-)[0-9.]+' -o
Apparently varnishd -V
writes to stderr
not stdout
. In order to pipe the result into grep
, you will need to redirect the stream e.g.
varnishd -V 2>&1 | grep -P '(?<=varnish-)[0-9.]+' -o
answered Oct 9 '17 at 13:12
steeldriver
32.1k34979
32.1k34979
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397005%2ftry-to-grep-out-varnish-version-does-not-work%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
If you just want the digits in decimal form, you will need something like grep -o '[0-9].[0.9].[0-9]'
â Raman Sailopal
Oct 9 '17 at 12:43
But this works: "httpd -version | grep -P '(?<=Apache/)[0-9.]+' -o". So why should this not work on the varnish version command?
â Klaus Hörmann-Engl
Oct 9 '17 at 12:46
1
Perhaps
varnishd -V
writes tostderr
notstdout
? Try appending2>&1
â steeldriver
Oct 9 '17 at 12:47
@steeldriver You were absolutely right. I needed to redirect the stderr to the stdout. Now it works like a charm: 'varnishd -V 2>&1 | grep -P '(?<=varnish-)[0-9.]+' -o' If you make an answer out of it, I will mark it as solved.
â Klaus Hörmann-Engl
Oct 9 '17 at 12:53