The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
35 views

Adding Curly Braces to Map block in nginx

I am having a problem trying to get the following configuration to work. Every time I run the config test I get a failed pass. To start off let me show you a working configuration location / { ...
1
vote
1answer
36 views

How to using sed to change the last character from a match line

How to using sed to change the last character from a match line ? Exemple: /etc/network/interfaces auto eth0 iface eth0 inet static address 150.0.3.50 netmask 255.255.255.0 ...
0
votes
0answers
18 views

How to escape pipeline char in Windows shell?

I need to specify a regular expression that includes | character to findstr command: processtext.exe | findstr /R "Hello|Bye" How do I escape it? \| does not work. Quotes fix issue with pipelining ...
0
votes
0answers
38 views

How to create a transport rule for emails sent to a specific domain

We've changed our primary domain from '.co. to '.co.uk' - quite some time ago. I've recently tried removing the .co recipient emails as part of a clean up. It seems as though the old domain is still ...
0
votes
1answer
57 views

Manage several sub domains with nginx

I like to handle different sub domains in my Nginx server, this is my config file (partially) server { listen 80 default_server; listen ...
0
votes
2answers
65 views

How to exclude a certain string in a search pattern

There are several exception messages in catalina.out file of tomcat server just like - java.lang.NullPointerException org.springframework.beans.factory.BeanCreationException ...
1
vote
1answer
203 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
544 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
182 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
3k 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
117 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
257 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
342 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
137 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
2answers
306 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 ...
3
votes
1answer
107 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
113 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
95 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
140 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
996 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
104 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
470 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
732 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
1k 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
3k 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
2k 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
1k 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 -> ...
1
vote
1answer
294 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: Thanks a lot ...
3
votes
1answer
738 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
458 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
462 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
629 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 ...
2
votes
1answer
3k 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
148 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 ...
2
votes
1answer
4k 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
401 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
103 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
1k 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
466 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
263 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
65 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
405 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
2k 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
474 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
1k 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
5k 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
52 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
145 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
353 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
1k 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 ...