Mochabomb

Web Design and Technical notes

Mochabomb header image 2

Diff and Patch Notes

February 28th, 2007 1:41 am · No Comments

Useful diff and patch commands:

Create a patch with 3 lines of context and amount of blank lines. I want to see other whitespace difference - it might expose a typo.

diff -u 3 oldfile newfile > patchfile

Use CVS diff to create a patch comparing the local file (newer) with the repository version.

cvs diff -up file > patchfile


Patch a file and create an orig copy (from http://gentoo-wiki.com/MAN_patch_1 ). The -B option allows the prefix for a file - in this case I’ll save it somewhere else as a patched file.

patch -b < patchfile
patch -B /home/user/patched < patchfile

Patch a file you specify

patch file_to_be_patched patchfile

Diff notes
<

# diff -h
usage: man [-c|-f|-k|-w|-tZT device] [-i|-I] [-adlhu7V] [-Mpath] [-Ppager]
           [-Cfile] [-Slist] [-msystem] [-pstring] [-Llocale] [-eextension]
           [section] page ...
-a, --all                   find all matching manual pages.
-d, --debug                 emit debugging messages.
-e, --extension             limit search to extension type `extension'.
-f, --whatis                equivalent to whatis.
-k, --apropos               equivalent to apropos.
-w, --where, --location     print physical location of man page(s).
-W, --where-cat,
    --location-cat          print physical location of cat file(s).
-l, --local-file            interpret `page' argument(s) as local filename(s).
-u, --update                force a cache consistency check.
-i, --ignore-case           look for pages case-insensitively (default).
-I, --match-case            look for pages case-sensitively.
-r, --prompt string         provide the `less' pager with a prompt
-c, --catman                used by catman to reformat out of date cat pages.
-7, --ascii                 display ASCII translation of certain latin1 chars.
-E, --encoding encoding     use the selected nroff device and display in pager.
-t, --troff                 use groff to format pages.
-T, --troff-device device   use groff with selected device.
-H, --html                  use lynx or argument to display html output.
-Z, --ditroff               use groff and force it to produce ditroff.
-X, --gxditview             use groff and display through gditview (X11):
                            -X = -TX75, -X100 = -TX100, -X100-12 = -TX100-12.
-D, --default               reset all options to their default values.
-C, --config-file file      use this user configuration file.
-M, --manpath path          set search path for manual pages to `path'.
-P, --pager pager           use program 'pager' to display output.
-S, --sections list         use colon separated section list.
-m, --systems system        search for man pages from other unix system(s).
-L, --locale locale         define the locale for this particular man search.
-p, --preprocessor string   string indicates which preprocessors to run.
                             e - [n]eqn   p - pic    t - tbl
                             g - grap     r - refer  v - vgrind
-V, --version               show version.
-h, --help                  show this usage message.
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • MisterWong
  • Reddit

Tags: CVS · Cygwin Linux · Subversion

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment