|
I'm not sure what happens when your from file and to file are the
same, and I think your from file needs a less than sign in front of
it:
sed 's|x|y|' <from.txt >to.txt
sed is a really powerful tool; I've been in this field 40 years, but
didn't get into regular expressions until our Linux guy quit. Now I
can write regular expressions that look like modem line noise.
Chris
chris-u56vBtvah+7YtjvyW6yDsg@xxxxxxxxxxxxxxxx
www.brilligware.com - The home of MineSweeper5250
On Fri, Nov 13, 2020 at 4:31 PM Dean Eshleman
<Dean.Eshleman-d3hNrR/acMxWk0Htik3J/w@xxxxxxxxxxxxxxxx> 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
This mailing list archive is Copyright 1997-2026 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.