04-26-2010
You need to match the line correctly (with literals and wildcards, etc). It seems you are only matching an optional '/' and then the literal string 'va' and then zero or more 'r' (greedy) and then the literal string 'lo' and then an optional 'g'.... which is not correct.
First of all, is '/var/log/*' always at the beginning of the line? What comes after?
It is always best to post the text in the file or variable you are trying to match so any member who wants to reply can test what they are doing against the text, not just incomplete fragments.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am attempting to convert rewrite rules to Nginx, and since due to the mass amount of rewrites we must convert, I've been trying to write a script to help me on a specific part, easily.
So far I have this:
rewrite ^action/static/(+)/$ staticPage.php?pg=$1&%$query_string;
What I want done... (5 Replies)
Discussion started by: EXT3FSCK
5 Replies
2. Shell Programming and Scripting
I want to block all special characters except alphanumerics.. and "."(dot ) character
currently am using //
I want to even block only single dot or multiple dots..
ex:
. or .............. should be blocked.
please provide me the reg ex.
---------- Post updated at 05:11 AM... (10 Replies)
Discussion started by: shams11
10 Replies
3. UNIX for Advanced & Expert Users
I have a large file encoded in Unicode that I need to convert to CSV. In general, I know how to do this by regular expression substitutions using sed or Perl, but one problem I am having is that I need to put a quotation mark at the end of each line to protect the last field. The usual regex... (1 Reply)
Discussion started by: thomas.hedden
1 Replies
4. Shell Programming and Scripting
I am trying to grep the following line in a file using a bash shell:
(..)
admin1::14959::::::
(..)
It works with the following expression (as expected)
# cat file | grep ^*::
admin1::14959::::::
but it does not work with (not expected)
# cat /etc/shadow | grep ^+::
I assume the... (2 Replies)
Discussion started by: schms
2 Replies
5. Shell Programming and Scripting
Hello,
Could someone explain why this one returns nothing:
$ x=/jon/
$ echo jon | awk -v xa=$x '$1~xa {print}'
$
while the following works fine:
$ x=jon
$ echo jon | awk -v xa=$x '$1==xa {print}'
$ jon
and the following works fine:
$ echo jon | awk '$1~/jon/ {print}'
$ jon
... (3 Replies)
Discussion started by: vilius
3 Replies
6. Emergency UNIX and Linux Support
Hi,
Server - MEDIAWIKI - MYSQL - CENTOS 5 - PHP5
I have a database import of close to a million pages into my wiki, mediawiki site,
the format that were left with is not pretty, and I need to find a way to clean this up and present it nicely...
I think regex is the best option as I can... (1 Reply)
Discussion started by: lawstudent
1 Replies
7. Shell Programming and Scripting
# check host value regex='^(||1|2|25)(\.(||1|2|25)){3}$' if ')" != "" ]; then if ]; then echo host $host not found exit 4 fi elif ]; then echo $host is an invalid host address exit 5 fi (1 Reply)
Discussion started by: kevin298
1 Replies
8. Shell Programming and Scripting
I have following expression:
echo "Sun 12 Jul BST 2014\nSun 12 Jul 2014\nSun 12 Jul IS 2014" | awk '/(Sun)+( 12)+( Jul )+({3} )?(2014)/{print;}'
I ran above code in AIX box and output is as follows
Sun 12 Jul BST 2014
Sun 12 Jul 2014
I ran above code in Linux box and output is as... (8 Replies)
Discussion started by: kamlesh_pradhan
8 Replies
9. UNIX for Beginners Questions & Answers
I have a XML file where there is a tag with like
<wd:address_line_1>1234 Street</wd:address_line_1>
I want to replace the values "1234 Street" with "Test Data". Different people have different address lines and i want to replace with a fixed value to mask the file. I was trying to use sed... (7 Replies)
Discussion started by: dr46014
7 Replies
10. UNIX for Beginners Questions & Answers
I am trying to add word in last of particular line.
the same command syntex is running on prompt. but in bash script give error."sed: -e expression #1, char 20: unterminated address regex"
Please help.
for i in `cat servername`;
do
ssh -q -t root@$i sed -i '/simple_allow_groups =/s/$/,... (4 Replies)
Discussion started by: yash_message
4 Replies
LEARN ABOUT CENTOS
varnishlog
VARNISHLOG(1) VARNISHLOG(1)
NAME
varnishlog - Display Varnish logs
SYNOPSIS
varnishlog [-a] [-b] [-C] [-c] [-D] [-d] [-I regex] [-i tag] [-k keep] [-n varnish_name] [-o] [-O] [-m tag:regex ...] [-P file] [-r file]
[-s num] [-u] [-V] [-w file] [-X regex] [-x tag]
DESCRIPTION
The varnishlog utility reads and presents varnishd(1) shared memory logs.
The following options are available:
-a When writing to a file, append to it rather than overwrite it.
-b Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishlog acts as if
they both were.
-C Ignore case when matching regular expressions.
-c Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishlog acts as if they
both were.
-D Daemonize.
-d Process old log entries on startup. Normally, varnishlog will only process entries which are written to the log after it starts.
-I regex
Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included.
-i tag Include log entries with the specified tag. If neither -I nor -i is specified, all log entries are included.
-k num Only show the first num log records.
-m tag:regex only list transactions where tag matches regex. Multiple
-m options are AND-ed together. Can not be combined with -O
-n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
-o Ignored for compatibility with earlier versions.
-O Do not group log entries by request ID. Can not be combined with -m.
-P file
Write the process's PID to the specified file.
-r file
Read log entries from file instead of shared memory.
-s num Skip the first num log records.
-u Unbuffered output.
-V Display the version number and exit.
-w file
Write log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified. If var-
nishlog receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away.
-X regex
Exclude log entries which match the specified regular expression.
-x tag Exclude log entries with the specified tag.
TAGS
The following log entry tags are currently defined:
o Backend
o BackendClose
o BackendOpen
o BackendReuse
o BackendXID
o CLI
o ClientAddr
o Debug
o Error
o ExpBan
o ExpKill
o ExpPick
o Hit
o HitPass
o HttpError
o HttpGarbage
o Length
o ObjHeader
o ObjLostHeader
o ObjProtocol
o ObjRequest
o ObjResponse
o ObjStatus
o ObjURL
o ReqEnd
o ReqStart
o RxHeader
o RxLostHeader
o RxProtocol
o RxRequest
o RxResponse
o RxStatus
o RxURL
o SessionClose
o SessionOpen
o StatAddr
o StatSess
o TTL
o TxHeader
o TxLostHeader
o TxProtocol
o TxRequest
o TxResponse
o TxStatus
o TxURL
o VCL_acl
o VCL_call
o VCL_return
o VCL_trace
o WorkThread
EXAMPLES
The following command line simply copies all log entries to a log file::
$ varnishlog -w /var/log/varnish.log
The following command line reads that same log file and displays requests for the front page::
$ varnishlog -r /var/log/varnish.log -c -m 'RxURL:^/$'
SEE ALSO
o varnishd(1)
o varnishhist(1)
o varnishncsa(1)
o varnishstat(1)
o varnishtop(1)
HISTORY
The varnishlog utility was developed by Poul-Henning Kamp <phk@phk.freebsd.dk> in cooperation with Verdens Gang AS, Varnish Software AS and
Varnish Software. This manual page was initially written by Dag-Erling Smorgrav.
COPYRIGHT
This document is licensed under the same licence as Varnish itself. See LICENCE for details.
o Copyright (c) 2006 Verdens Gang AS
o Copyright (c) 2006-2011 Varnish Software AS
AUTHOR
Dag-Erling Smorgrav, Per Buer
0.2 2010-05-31 VARNISHLOG(1)