[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "diff -R" to swap file1 and file2?
From: |
Chris Jones |
Subject: |
Re: "diff -R" to swap file1 and file2? |
Date: |
Wed, 02 Feb 2011 18:45:16 -0500 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Wed, Feb 02, 2011 at 06:59:55AM EST, Harald Dunkel wrote:
> Hi folks,
>
> would it be possible to add a flag "-R" or "--reverse"
> to the diff command line options to swap left and right
> side file on the fly?
>
> If you made a mistake on writing the diff command line,
> then adding a "-R" would be much easier and less error-
> prone than moving one of the pathnames within the command
> line.
>
> This option would be pretty similar to "patch -R".
>
> Just a suggestion, of course. Regards
Makes sense.. in the meantime, with bash+readline, this is how I do it:
1. I retrieve my command:
CTRL-P
$ diff file.file1 file.file2
2. I delete/yank the second file name:
CTRL-W
Result.. with ‘^’ marking the cursor's position:
$ diff file.file1
^
3. I move the cursor to the first character of file #1:
ALT-B ALT-B
Results in:
$ diff file.file1
^
4. I paste the second file name:
CTRL-Y
Now it looks like so:
$ diff file.file2file.file1
^
5. And finally... I press the Space Bar & hit <Enter>:
$ diff file.file2 file.file1
Takes less than a second (and about five minutes to put in words) .. and
since I'm only yanking & pasting, not error-prone.. :-)
cj