You probably need "patch -p3 </path/to/patch". Essentially what you're doing here is removing preceding slashes from the pathname of each file. So, for example, if your path was
/path/to/some/directory/file.txt -p0: /path/to/some/directory/file.txt -p1: path/to/some/directory/file.txt -p2: to/some/directory/file.txt -p3: some/directory/file.txt -p4: directory/file.txt -p5: file.txt Remove the number of directories necessary to get a pathname relative to your current directory. In the future, I would highly recommend unified patch format: (diff -uNr <dir1> <dir2>), as the context provided can allow for a degree of fuzzy matching. On Mon, Sep 21, 2015 at 7:53 PM, Paul Boniol <[email protected]> wrote: > On 1. Thanks, but there are lots of changes on both sides of the diff input > directories. Some changes are desired on each side. I might be able to copy > and then mass change the source directory.... Hm.... There are possibilities > here for the next part. It would reduce the amount of crud I have to look > through. Thanks for the suggestion on the next part of what I need to do! > (If absolutely necessary, it would cut down on time spend redoing what I > did.) > > On 2. The full paths are specified in the existing diff output. I want to > update the file specified first. > > Here is a sample format of what I've got, spent a lot of time on it already, > rather not have to redo... > > diff -r /mnt/files-to-update-dir/file.pl > /mnt/files-with-desired-changes/file.pl > 6c6 > < use lib "/mnt/my-old-lib-dir;"; > --- >> use lib "/mnt/my-new-lib-dir"; > > There are more involved changes, but that is the basic format I have 531 > lines in now. (I must say, I like looking at this diff format rather than > what patch appears to like.) > > Paul > > On Mon, Sep 21, 2015 at 7:34 PM, Csaba Toth <[email protected]> wrote: >> >> 1. Try changing the situation so the generated file will be right away >> what you want rather than editing. >> Patch file is not a rocket science though, so there's a chance you can >> edit it nicely. >> 2. Always take care the directory level when you apply the patch vs the >> level at the generation of the patch. >> Also take a look at patch, which is a wrapper over diff. >> >> >> On Mon, Sep 21, 2015 at 5:26 PM, Paul Boniol <[email protected]> >> wrote: >>> >>> I rarely need to do a diff/patch.. but now I do. I should have Googled >>> first or tried a small amount... >>> >>> If I did >>> diff -r old-file-dir new-file-dir > mydiff >>> >>> Edited mydiff to only contain just changes I want applied to old-file-dir >>> files. Is there any hope of using patch to apply the differences? >>> >>> Patch says "Only garbage was found in the patch input.". >>> >>> I now see I should have added more flags to the diff... but after a few >>> hours of working to get just the changes I want. >>> >>> Thank you! >>> >>> -- >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "NLUG" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/nlug-talk?hl=en >>> >>> --- >>> You received this message because you are subscribed to the Google Groups >>> "NLUG" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> -- >> You received this message because you are subscribed to the Google Groups >> "NLUG" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nlug-talk?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "NLUG" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. > > > -- > -- > You received this message because you are subscribed to the Google Groups > "NLUG" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nlug-talk?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "NLUG" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- Tilghman -- -- You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en --- You received this message because you are subscribed to the Google Groups "NLUG" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
