× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Redirection in Qshell has some quirks. There are a couple of options. If you are using the new rpm version of sed, then It should have inplace
STRQSH CMD('sed -i "s/10\.2\.0\.109/10.202.0.109/" /home/jdeane/httpd_dr.conf')


Or you can play tricks with the output.
STRQSH CMD('sed "s/10\.2\.0\.109/10.202.0.109/" /home/jdeane/httpd_dr.conf | cat > /home/jdeane/httpd_dr.conf')

On Fri, 2020-11-13 at 22:31 +0000, Dean Eshleman wrote:

Thanks Chris and Kevin. I made it a little further. My problem was the missing / after the last 109. It now runs successfully, but I end up with an empty file. Here is the command I ran. I did try it using [] around the periods as well, but that didn't make a difference. I also tried adding "g" at the end, but that didn't help either. I'm probably doing something silly. I double checked the name of the file I'm testing with.


STRQSH CMD('sed "s/10\.2\.0\.109/10.202.0.109/" /home/jdeane/httpd_dr.conf > /home/jdeane/httpd_dr.conf')


Here are the first few lines of the configuration file.


# Configuration originally created by Create HTTP Server wizard on Thu Jan 18 15:55:35 EST 2018

Listen 10.2.0.109:8700

DocumentRoot /www/websvc_prd/htdocs

TraceEnable Off

Options -ExecCGI -FollowSymLinks -SymLinksIfOwnerMatch -Includes -IncludesNoExec -Indexes -MultiViews

LogFormat "%h %T %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%{Cookie}n \"%r\" %t" cookie

LogFormat "%{User-agent}i" agent

LogFormat "%{Referer}i -> %U" referer

LogFormat "%h %l %u %t \"%r\" %>s %b" common

CustomLog logs/access_log combined

LogMaint logs/access_log 14 0

LogMaint logs/error_log 14 0


As you can see, the second line contains the ip address I want to update. Not sure why it is wiping out the entire file.


Dean Eshleman


On 11/13/2020 4:18 PM, Chris Pando wrote:

sed 's/10[.]2[.]0[.]109/10.202.0.109/'


Chris


<mailto:chris-u56vBtvah+7YtjvyW6yDsg@xxxxxxxxxxxxxxxx>

chris-u56vBtvah+7YtjvyW6yDsg@xxxxxxxxxxxxxxxx


<http://www.brilligware.com>

www.brilligware.com

- home of mineSweeper5250


On Fri, Nov 13, 2020, 3:11 PM Dean Eshleman <Dean.Eshleman-d3hNrR/acMxWk0Htik3J/

<mailto:w@xxxxxxxxxxxxxxxx>

w@xxxxxxxxxxxxxxxx



wrote:


Hi,


I'm trying to use sed to find and replace an IP address in a Apache config

file as part of switching over to our DR machine. I want to script the

process rather than doing it manually. I need to replace 10.2.0.109 with

10.202.0.109. Here is what I have tried based on examples I found online.

Since there are periods involved in the string, I thought I needed to

escape them.


STRQSH CMD('sed "s/10\.2\.0\.109/10\.202\.0\.109"

/home/jdeane/http_dr.conf > /home/jdeane/http_dr.conf')


When I run this, I receive an error "there is an incomplete substitution

in a regular expression". Anyone have any ideas?


Dean Eshleman

Software Development Architect

Everence


1110 North Main Street

PO Box 483

Goshen, IN 46527

(800) 348-7468 ext. 3528

(574) 533-9515 ext. 3528

[Join our Talent Network]<

<http://www.everence.com/careers>

http://www.everence.com/careers




Confidentiality Notice: This information is intended only for the

individual or entity named. If you are not the intended recipient, do not

use or disclose this information. If you received this e-mail in error,

please delete or otherwise destroy it and contact us at (800) 348-7468 so

we can take steps to avoid such transmission errors in the future. Thank

you.

--

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list

To post a message email:

<mailto:MIDRANGE-L-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@xxxxxxxxxxxxxxxx>

MIDRANGE-L-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@xxxxxxxxxxxxxxxx


To subscribe, unsubscribe, or change list options,

visit:

<https://lists.midrange.com/mailman/listinfo/midrange-l>

https://lists.midrange.com/mailman/listinfo/midrange-l


or email:

<mailto:MIDRANGE-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@xxxxxxxxxxxxxxxx>

MIDRANGE-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@xxxxxxxxxxxxxxxx


Before posting, please take a moment to review the archives

at

<https://archive.midrange.com/midrange-l>

https://archive.midrange.com/midrange-l

.


Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related

questions.


Help support midrange.com by shopping at amazon.com with our affiliate

link:

<https://amazon.midrange.com>

https://amazon.midrange.com




Confidentiality Notice: This information is intended only for the individual or entity named. If you are not the intended recipient, do not use or disclose this information. If you received this e-mail in error, please delete or otherwise destroy it and contact us at (800) 348-7468 so we can take steps to avoid such transmission errors in the future. Thank you.



[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.