![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 25/08/2011 05:14 PM, Warp wrote:
> Invisible<voi### [at] dev null> wrote:
>> The question was more "is there already a button that does that?" I
>> could implement such a feature in any language. The question was whether
>> one is already present.
>
> "I want to edit all of the others in the same way" is quite a vague
> description. I don't even know what exactly you mean by that.
>
> There's probably no "button" to do that (although it wouldn't surprise
> me if there was). It doesn't sound like an extremely common task.
As best as I can tell, it's a line-based file format, where each line
contains a key/value pair. Basically if I use the tool and it changes
the line that says "mode=7" to read "mode=9", then I want to make that
change to all the files in the set. Similarly if it adds a new line or
removes an existing one.
I imagine you can probably do it somehow using diff and patch. But those
aren't usually present on Windows. (I gather Emacs has a special mode
for viewing the output from diff or something like that... Presumably
that only works on Unix though.)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Orchid XP v8 <voi### [at] dev null> wrote:
> As best as I can tell, it's a line-based file format, where each line
> contains a key/value pair. Basically if I use the tool and it changes
> the line that says "mode=7" to read "mode=9", then I want to make that
> change to all the files in the set. Similarly if it adds a new line or
> removes an existing one.
Usually you'd do a search&replace on multiple files to do that. I don't
know offhand if emacs has readymade support for search&replace on multiple
files, but it sounds like something that could be done with just a bit of
elisp. (Normally you would do this on the command line using 'sed' or other
similar tools, unless the changes are very complex, in which case it becomes
more difficult.)
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Orchid XP v8 escreveu:
> On 25/08/2011 05:14 PM, Warp wrote:
>> Invisible<voi### [at] dev null> wrote:
>>> The question was more "is there already a button that does that?" I
>>> could implement such a feature in any language. The question was whether
>>> one is already present.
>>
>> "I want to edit all of the others in the same way" is quite a vague
>> description. I don't even know what exactly you mean by that.
>>
>> There's probably no "button" to do that (although it wouldn't surprise
>> me if there was). It doesn't sound like an extremely common task.
>
> As best as I can tell, it's a line-based file format, where each line
> contains a key/value pair. Basically if I use the tool and it changes
> the line that says "mode=7" to read "mode=9", then I want to make that
> change to all the files in the set. Similarly if it adds a new line or
> removes an existing one.
>
> I imagine you can probably do it somehow using diff and patch. But those
> aren't usually present on Windows. (I gather Emacs has a special mode
> for viewing the output from diff or something like that... Presumably
> that only works on Unix though.)
Install perl. I don't remember perl at all, but it's probably a simple
one-liner. A few switches on the command line and a simple regex
substitution should do the trick. The right tool for the job, plain and
simple. And yes, it's available for windows in a standard windows
install package.
--
a game sig: http://tinyurl.com/d3rxz9
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> As best as I can tell, it's a line-based file format, where each line
>> contains a key/value pair. Basically if I use the tool and it changes
>> the line that says "mode=7" to read "mode=9", then I want to make that
>> change to all the files in the set. Similarly if it adds a new line or
>> removes an existing one.
>>
>> I imagine you can probably do it somehow using diff and patch. But
>> those aren't usually present on Windows. (I gather Emacs has a special
>> mode for viewing the output from diff or something like that...
>> Presumably that only works on Unix though.)
>
> Install perl. I don't remember perl at all, but it's probably a simple
> one-liner. A few switches on the command line and a simple regex
> substitution should do the trick. The right tool for the job, plain and
> simple. And yes, it's available for windows in a standard windows
> install package.
The right tool for the job would obviously be some sort of file
comparison tool - which Perl isn't.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>>> As best as I can tell, it's a line-based file format, where each line
>>> contains a key/value pair. Basically if I use the tool and it changes
>>> the line that says "mode=7" to read "mode=9", then I want to make that
>>> change to all the files in the set. Similarly if it adds a new line or
>>> removes an existing one.
>>>
>>> I imagine you can probably do it somehow using diff and patch. But
>>> those aren't usually present on Windows. (I gather Emacs has a special
>>> mode for viewing the output from diff or something like that...
>>> Presumably that only works on Unix though.)
>>
>> Install perl. I don't remember perl at all, but it's probably a simple
>> one-liner. A few switches on the command line and a simple regex
>> substitution should do the trick. The right tool for the job, plain and
>> simple. And yes, it's available for windows in a standard windows
>> install package.
>
> The right tool for the job would obviously be some sort of file
> comparison tool - which Perl isn't.
Do you need to make the same change in each file? If so, Perl or sed,
or awk are perfect tools for the job.
I don't see where diff comes into play...
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Francois Labreque <fla### [at] videotron ca> wrote:
> > The right tool for the job would obviously be some sort of file
> > comparison tool - which Perl isn't.
> Do you need to make the same change in each file? If so, Perl or sed,
> or awk are perfect tools for the job.
> I don't see where diff comes into play...
The problem sounds indeed like a simple search&replace task, which
tools like sed or perl are designed for.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> The right tool for the job would obviously be some sort of file
>> comparison tool - which Perl isn't.
>
> Do you need to make the same change in each file? If so, Perl or sed, or
> awk are perfect tools for the job.
>
> I don't see where diff comes into play...
diff compares files and automatically figures out what changed.
patch automatically applies those changes to other files.
...which neatly describes the exact thing I'm trying to do.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> The problem sounds indeed like a simple search&replace task, which
> tools like sed or perl are designed for.
So I've got to manually compare the files and figure out what changed
(admittedly, a fairly easy if tedious task), and then construct an
elaborate regex to tell Perl how to do that?
Looks like it's time to write some custom automation. Or stop using the
tool that's causing me the problem in the first place...
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Invisible <voi### [at] dev null> wrote:
> >> The right tool for the job would obviously be some sort of file
> >> comparison tool - which Perl isn't.
> >
> > Do you need to make the same change in each file? If so, Perl or sed, or
> > awk are perfect tools for the job.
> >
> > I don't see where diff comes into play...
> diff compares files and automatically figures out what changed.
> patch automatically applies those changes to other files.
> ...which neatly describes the exact thing I'm trying to do.
That still doesn't explain what exactly is it that you want to do.
If you change line 35 in one file, should line 35 be changed accordingly
in all files? What if that line is completely unrelated in the other files?
How should the script find the correspondent line in the other files? What
if some of the other files do not have any such line, or have several that
match the criterion? (And that's assuming the script could figure out the
criterion you are thinking. How can it know that?) How do you even define
this criterion for matching the "same" line in all the files?
Your "make the same edit in all files" is still *way* too vague to give
any kind of rational answer. As you describe it, it just sounds like what
you want is for the computer to "do what I want", without you even knowing
yourself how to express clearly and unambiguously what it is that you want
(something I find rather strange from a computer programmer).
If what you mean is that "all the files have key-value pairs in them
and I want all the values at certain keys changed", that sounds exactly
like a search&replace task: Search for the key, change the value.
If what you want is "parse this file for key-value pairs, and then check
all the other files, and whenever there's the same key as in the first file,
change the value to be the same", that sounds like you want to write a
program to do that. 'diff' and 'patch' have no concept of keys and values.
They are not syntax parsers. (This is especially so because often such
key-value configuration files have *sections*, and the same key could well
appear in different sections, with a different meaning. You can't do this
change on a line-per-line comparison basis. You have to parse the entire
sections.)
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> diff compares files and automatically figures out what changed.
>
>> patch automatically applies those changes to other files.
>
>> ...which neatly describes the exact thing I'm trying to do.
>
> That still doesn't explain what exactly is it that you want to do.
> Your "make the same edit in all files" is still *way* too vague to give
> any kind of rational answer. As you describe it, it just sounds like what
> you want is for the computer to "do what I want", without you even knowing
> yourself how to express clearly and unambiguously what it is that you want
> (something I find rather strange from a computer programmer).
I guess I'm just used to using Darcs.
If I edit a line in the middle of the foo() function, Darcs notices
this, and creates a patch describing it. If some other user applied this
patch to their copy of the file, where foo() might be defined on a
higher or lower line number (because of other stuff added or removed to
their copy of the file), it Just Works the way you'd expect. Darcs finds
out where the corresponding line is, and mades the same change. Without
me having to worry about how it actually works.
That said, in this instance, because we're only talking about key/value
pairs with a fairly simple syntax, it's probably simplest if I just code
up something that directly does what I actually want, rather than trying
to cable together existing tools which only solve part of the problem...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |