Sed replace path for directory from special file with delimirers slash

i should change on parameter to other from template file in linux. sed -e “s/\${dir}/<in this place i should input path, like /home/username>/” /etc/nginx/site.conf But it does not work. How to resolve it ? May be there are other ways, how to resolve it ? Thanks for your attention. Answer You did not tell us … Read more

validate file content with bash Regular Expressions + Linux

how to validate the following file content that should be include single integer/float number by bash Regular Expression or any other idea with awk/sed cat /var/VERSION/Version_F35_project_usa 2.8 Answer Your regexp is /\A\d+.?\d+\Z/g AttributionSource : Link , Question Author : jango , Answer Author : Ivan Mastrenko

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 -> emptAB How can I make regular expressions for these? Answer Not sure if i understood correctly what you want, but i think you need something like this: … Read more

sed + replace value default in grub.conf [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Server Fault. Closed 5 years ago. Improve this question I want to change the default value on all machines to default=0 default value could be any integer number how to set in … Read more

I am trying to write an htaccess file performs authentication and redirects authenticated users to authorized directories. Can anyone help me with the condition syntax?

This is what I have so far but I can’t get the RewriteCond and RewriteRule properly. RewriteEngine On RewriteCond %{LA-U:REMOTE_USER} (\d{3})$ RewriteRule !^%1 http://subdomain.mydomain.com/%1 [R,L]. AuthName “My Domain Protected Area” AuthType Basic AuthUserFile /path/to/my/.htpasswd Require valid-user This is what I mean the ReWriteCond and RewriteRule to say: “If the REMOTE_USER has a username ending in … Read more

Need regular expression + Apache help urgently!

I want staging.mywebsite.com to point to the staging virtual host, for the live I want mywebsite.com and www.mywebsite.com to point to the live one etc., and then for *(everythingelse).mywebsite.com needs to point to the development server. Anyone have any idea?! I posted a couple times on StackOverflow to no avail. EDIT: I only have 1 … Read more

Apache mod_rewrite reg expression

I have to manage a huge web site which has coded with absolute paths like: <a href=’http://www.samewebsite.net/anotherPage.cfm’>link to another page in the site.</a> Now, as I previously said, the web site has many pages and I’m not paid for changing manually all the absolute URLs into relatives. Someone suggested me to try use the mod_rewrite … Read more

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 “\u002fmeis2\u002f[X] I’m not sure how the Regex works in Apache — I think it’s the same as Perl 5? — but … Read more

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 seeing that I cannot account for all pages is there a way to capture a page that I may have missed and … Read more