Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #243603

Re: Replace line in file based on pattern

From "Paul M. Foster" <paulf@quillandmouse.com>
Newsgroups linux.debian.user
Subject Re: Replace line in file based on pattern
Date 2022-01-03 04:00 +0100
Message-ID <DBlJL-2Fl-1@gated-at.bofh.it> (permalink)
References <DBi9c-Mv-5@gated-at.bofh.it> <DBisy-SG-3@gated-at.bofh.it> <DBiLU-Z6-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 1/2/22 6:40 PM, Greg Wooledge wrote:
> On Sun, Jan 02, 2022 at 06:20:15PM -0500, The Wanderer wrote:

> Of course, given the ORIGINAL question, the best tool is neither of these.
> It's something like ansible or puppet.  Or if you insist on jury-rigging
> crap together with stone knives and bearskins, ssh and patch.
> 

Regarding "patch", let's consider a "stock" config file from a fresh 
install (call it NEW), and an existing config which is tweaked for my 
purposes (call it OLD). Assume I want the stock config altered to 
conform to my existing/working installation.

To make patch work, I need a diff file, which I get from diffing OLD and 
NEW. From there, I use patch and the diff to bring NEW to conform to 
OLD, more or less.

Once I've gone through this whole evolution, how is this process 
different from simply copying OLD over the top of NEW? Bear in mind that 
we aren't working with C files here, but config files, where changes are 
minimal and possibly confined to a small area.

I'm not being sarcastic or argumentative. I'm genuinely trying to 
understand how patch would be a real/superior solution.

Paul

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Replace line in file based on pattern "Paul M. Foster" <paulf@quillandmouse.com> - 2022-01-03 00:10 +0100
  Re: Replace line in file based on pattern Andy Smith <andy@strugglers.net> - 2022-01-03 00:20 +0100
    Re: Replace line in file based on pattern "Paul M. Foster" <paulf@quillandmouse.com> - 2022-01-03 03:00 +0100
  Re: Replace line in file based on pattern The Wanderer <wanderer@fastmail.fm> - 2022-01-03 00:30 +0100
    Re: Replace line in file based on pattern Greg Wooledge <greg@wooledge.org> - 2022-01-03 00:50 +0100
      Re: Replace line in file based on pattern The Wanderer <wanderer@fastmail.fm> - 2022-01-03 02:20 +0100
        Re: Replace line in file based on pattern Greg Wooledge <greg@wooledge.org> - 2022-01-03 02:50 +0100
          Re: Replace line in file based on pattern "Paul M. Foster" <paulf@quillandmouse.com> - 2022-01-03 03:30 +0100
            Re: Replace line in file based on pattern Andrei POPESCU <andreimpopescu@gmail.com> - 2022-01-15 13:40 +0100
      Re: Replace line in file based on pattern "Paul M. Foster" <paulf@quillandmouse.com> - 2022-01-03 04:00 +0100
        Re: Replace line in file based on pattern Greg Wooledge <greg@wooledge.org> - 2022-01-03 05:10 +0100
          Re: Replace line in file based on pattern "Paul M. Foster" <paulf@quillandmouse.com> - 2022-01-03 14:40 +0100
            Re: Replace line in file based on pattern David Wright <deblis@lionunicorn.co.uk> - 2022-01-04 20:50 +0100
    Re: Replace line in file based on pattern "Paul M. Foster" <paulf@quillandmouse.com> - 2022-01-03 03:00 +0100
      Re: Replace line in file based on pattern john doe <johndoe65534@mail.com> - 2022-01-03 07:50 +0100

csiph-web