The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
66 views

htaccess rule for url not ending with certain words

I need to rewrite few urls if those url not ending with certain words. For example, i need to rewrite following url /category1/subcategory1/aproduct-url-title to ...
0
votes
2answers
255 views

Zabbix doesn't update value from file neither with log[] nor with vfs.file.regexp[] item

I am using Zabbix 2.2. I have a very specific environment, where I have to generate desired data to file via script, then upload that file to ftp from host and download it to Zabbix server from ftp. ...
1
vote
1answer
126 views

SetEnvIfNoCase directive match ip failing

I'm trying to set some specific headers based on the client IP address via an Apache reverse proxy. I try to use SetEnvIfNoCase/SetEnvIf but I somehow fail to write a correct regular expression :( ...
0
votes
2answers
1k views

Zabbix 2.0: Regular Expression to extract value from a String for a trigger?

I am using Zabbix 2.0.4 to monitor several Java applications. Most values are exported via JMX. One of those exported attributes is a string that is constructed like this: ...
0
votes
2answers
70 views

Regular expression for monitoring HTTP errors in apache logs

I'm looking for a regular expression that I can use to scan for HTTP errors in my standard apache log files. I'm interesting in matching all lines that don't have an HTTP 200 or HTTP 204 return ...
1
vote
0answers
164 views

How to specify a scenario wildcard in Zabbix expression

I'm using Zabbix 2.0 am wondering how to use a wildcard or regular expression for a scenario name of a trigger? For example, I have the following trigger: ...
0
votes
1answer
209 views

NGiNX and MediaWiki rewrite regular expression

I am having some problems with regular-expression with rewrite in NGiNX. Here is my config: location /wiki/ { rewrite ^/([^?]*)/([^?]*)(?:\?(.*))? /$1/index.php?title=$2&$3 last; ...
1
vote
0answers
81 views

Nginx - Adding a trailing slash to urls on HTTPS

I am using the below regex to add a trailing slash to any url that doesn't have a railing slash or ends ends with .. rewrite ^([^.]*[^/])$ $1/ permanent; This works fine for http, but when I use ...
0
votes
1answer
198 views

nginx dynamic servername with regular expression doesn't work for co.uk

I'm trying to setup a nginx server which dynamically loads content from a folder for a domain. To do this I'm using regular expressions in the server name like so: server_name ...
2
votes
1answer
75 views

nginx - which way is better to redirect and why

I want to redirect from www.mydomain.com to domain.com in nginx. I search the internet and found two ways: First way server { listen 80; server_name www.domain.com; ...
3
votes
2answers
84 views

Case insensitive exiqgrep?

My mail queue is currently full of bounce messages for the same domain, but in mixed case. I tried using exiqgrep to filter these mails from my queue, but it seems that the command is case sensitive. ...
1
vote
1answer
70 views

Problematic Mail Sieve rules

I need top classify my incomming emails using this three rules: if the email was send to any @somedomain.tld, then copy that email to "somedomain_tld" if the email was send to any other @*.tld , ...
4
votes
1answer
101 views

Apache MatchRedirect exception regex

I want to redirect any URL that is Https and hasn't start with "system_" to the same URL with http. for exapmle for this url : https://exsite.tld/some/thing/that/not/start/with/pattern to : ...
0
votes
2answers
208 views

RewriteCond RequestURI why RegEx doesn't work?

i have a working RewriteCond like: RequestURL: http://www.myserver.com/images/gallery/summer/2013/2013-07-07/thumbs/001.jpg RewriteCond %{REQUEST_URI} !images/gallery/summer/2013/* RewriteRule ...
0
votes
1answer
67 views

Regular expression to match non-www and non-specified host (nginx)

server { listen 80; server_name ~(?!^www\.)(?!thehost.org); return 301 $scheme://www.$host$request_uri; } I'd like for the server_name to match otherhost.org and ...
0
votes
1answer
265 views

JunOS Regular Expressions for AS Path

I want to write a regex in Juniper MX960 router for BGP including 3 AS paths with first element is constant, second and third are wildcard. I found that we can put as numbers manually like this: ...
2
votes
1answer
449 views

rsync certain files, excluding the rest, ignoring .svn/ directory, recursively

I'm using rsync to copy some files from a share to another. Recursively, I need to: Delete files at destination that were removed from the origin Only sync php and js files Exclude every other file ...
1
vote
2answers
659 views

How to find files that don't contain a given search string

I have a command that finds all the PDF files that contain the string "Font" find /Users/me/PDFFiles/ -type f -name "*.pdf" -exec grep -H 'Font' '{}' ';' How can I change this command such that it ...
0
votes
2answers
1k views

nginx simple regex location

I need to set a location param in nginx if the first 5 digits of the url are numbers. site.com/12345/ or site.com/12345 But I can't for the life of me seem to get the correct regular expression. ...
0
votes
1answer
828 views

nginx httpMapModule regex variables

The HttpMapModule documentation states that: Since 1.0.4, case insensitive regular expressions can be used by prefixing the pattern with ~*. And gives the example: map $uri $myvalue { /aa ...
-1
votes
1answer
661 views

how to make regular expression for nginx rewrite

i wrote rewrite ^/([\w_]+)/?$ /index.php?$1 btw, i wanna except /empty. hmm.. wanna use /alphabet -> alphabet /emptyABC -> emptyABC /empty -> not match /emp -> emp /emptAB -> ...
2
votes
2answers
255 views

Postfix header checks

How can I write regex for postfix header check to reject all the mails with X-Source-Dir having abc/def? Is this OK? /^X-Source-Dir:\s(.*abc\/def.*)/ REJECT due to spam:
3
votes
1answer
527 views

Powershell deleting files with regular expressions

I have several thousand files of different revisions in a folder. ACZ002-0.p ACZ002-1.p ACZ002-2.p ACZ051-0.p ACZ051-1.p ... The revision is always the last digit before the dot. I need to preserve ...
0
votes
2answers
252 views

How to clear contents of all the files using find command

Is there an easy step to clear contents of all ".log" file using find command. Currently i am using "echo -n > filename.log" i have tried echo -n > /var/application-logs/*.log but it is not ...
18
votes
1answer
454 views

Why bracket a single letter in a grep regex?

I've seen several instances where people are doing this: grep [f]oobar But I don't understand why that is preferable to grep foobar
1
vote
2answers
385 views

Extract repository name from GitHub url in bash

Given ANY GitHub repository url string like: git://github.com/some-user/my-repo.git or git@github.com:some-user/my-repo.git or https://github.com/some-user/my-repo.git What is the best way in ...
1
vote
1answer
2k views

inotifywait usage and exclude

I want to monitor special path to any event of create or modified files recursively in it via inotifywait but I don't know what's my problem is. I have some folders that I want to exclude. watchpath ...
2
votes
2answers
130 views

Display nth instance of grepped pattern

So here's my problem. I have an issue with a .csv file (Current.csv) in that there are commas randomly place throughout the data, so awk-ing the file doesn't give me constant column numbers for a ...
1
vote
1answer
3k views

use sed in shell script to replace IP Address in a file

I have a script that finds a string in a file replaces it with a new string. $ sed -i 's/$old_string'/'$new_string'/g' $FILENAME Now I need the condition to be a regular expression that also check ...
0
votes
1answer
340 views

apache virtualhost: Auto subdomain with exception

I've been searching for a way to automatically redirect domains to a specific folder, and fond a good answer here on serverfault: Apache2 VirtualHost auto subdomain. (The accepted answer) So far ...
1
vote
1answer
101 views

Regular expressions in GREP [closed]

I have an .xml file. The tags inside are: <Info>Product</Info> Now, I have 20 000 tags like this in the file. One tag however, starts properly but it is missing a proper closing tag. ...
2
votes
3answers
811 views

Regular Expression matching in ssh config

I have a bunch of servers with the names srv1.domain.com, srv2.domain.com, ..., srv50.domain.com I want to be able to connect to these servers by ssh srv1 I don't want to put 50 configuration ...
0
votes
1answer
385 views

Modify swatch conf files to match multiple lines below a match

We use swatch for reading PHP logs and email them to us. Currently it emails one single line of the error, but fails to match the next few lines of stack trace. For example: for log file like this: ...
1
vote
3answers
240 views

Getting different values of particular variable from a file in UNIX

I have a file which I'd like to parse to extract certain values from it. I don't know what command and syntax I should use (maybe sed?). Below are 2 sample lines which I might expect to find in the ...
2
votes
2answers
64 views

Get Apache2.2 to hide Microsoft documents that are being edited?

I have a htdocs directory where I am serving a few Microsoft Word documents. When someone is editing a document, the name of the document changes to look like something like this: ...
0
votes
1answer
284 views

Redirect a url to a different server

I'm looking for a way to redirect any url I visit on my computer (Mac), say www.example1.com/a/b/[\d]+, to another url www.example2.com/a/[\d]+. I don't want this to be on the IP level, just for that ...
0
votes
2answers
1k views

Use regular expression in definition of virtualhost

I have to define about 100 subdomain virtualhost entries in server config file . I want to know if there is any way to do it with regular expression to increase codes in apache config file?
0
votes
3answers
395 views

grep out unique senders from a huge list of emails

I just found a huge list of emails under my user account in Centos /home/user/mail/new I opened some of them and noticed they were sent from a particular cron job. From address is root@hostname.com. ...
2
votes
1answer
967 views

Postfix setting reply-to field to sender

I would like to set the reply-to field to the sender of the mail if the recipient matches some addresses. I know I could do a regular expression like this to do this /^(To|Cc):.*foo@bar.com/ PREPEND ...
5
votes
1answer
4k views

Powershell 2: How to strip a specific character from a body of ASCII text

I am trying to strip odd characters from strings using PowerShell. I used the following output to attempt to learn on my own: get-help about_regular_expressions I am trying to take a string that is ...
-2
votes
1answer
48 views

matching any part of a expression using grep

How Can I use grep so as to return me all matches for not only entire expression but also any part of the expression. example: grep "foobar" foo where foo contains text foo should give me a match ...
0
votes
1answer
139 views

Help with regexp in <Files> tag of .htaccess

For poorly configured Apache servers you can have to do something like this to deny access to the .htaccess file: <Files .htaccess> order allow,deny deny from all </Files> I would like ...
0
votes
1answer
343 views

Can I have IIS rewrite rules write to a file?

Extendng on my question at Is it possible to write a regular expression that catches a match that others have missed in IIS? I would like to know if I can have the rewrite rules write to a file. For ...
0
votes
1answer
749 views

Is it possible to write a regular expression that catches a match that others have missed in IIS?

I have written a list of regular expressions that currently redirect unused pages to the appropriately used pages e.g. if someone were to request abc.aspx it redirects them to home.aspx in IIS however ...
1
vote
1answer
1k views

Install yum packages based on regular expression

I would like to install a batch of openoffice.org-* packages from the yum repository. The catch is that I want to exclude the dozens of openoffice.org-langpack* files when I do it. I also don't want ...
1
vote
2answers
1k views

Watchguard Firewall WebBlocker Regular Expression for Multiple Domains?

I'm pretty sure this is really a regex question, so you can skip to REGEX QUESTION if you want to skip the background. Our primary firewall is a Watchguard X750e running Fireware XTM v11.2. We're ...
1
vote
2answers
136 views

Need help with grep urgently to comply with subpoena request

I am not a system administrator but I run a little website and today I have received a subpoena request from police, in order to comply I need to extract IP addresses from our server logs for needed ...
1
vote
2answers
1k views

RegEx Match URL Pattern

I'm trying to come up with a regex pattern that will match any domains in this format: example.com but not this: subdomain.example.com Currently it needs to only cover the main TLDs (com, net, ...
0
votes
1answer
639 views

Apache mod_proxy_html Substitute: how to re-use part of regex match? (regex variables?)

Have a unique URL-rewriting situation in Apache. I need to be able to take a URL that starts with "\u002f[X]" or '\u002f[X]" Where X is the rest of some URL, and substitute the text ...
2
votes
1answer
153 views

Regular expressions and .htaccess - need help with understanding

I understand .htaccess and mod_rewrite on a fairly basic level, and have just started learning ForceType and SetHandler directives. This is my .htaccess file for my domain, testsite1.localhost (only ...