About

Information is always Worth to save ...

Tuesday, March 31, 2009

Generating a patch

If you need to generate a patch file for a set of file(s) residing in a directory structure or just for one file, then you can use "diff" command. You can find a very nice article in Linux Magazine named "What's the diff?". Basically, this command finds out the difference between two files.

If you want to generate a patch for a directory structure:
diff -rau "old_dir" "modified_dir" > "patch_file"

r: recursive
a: treat all files as text.
u: Output NUM (default 3) lines of unified context.
In case of two file, ignoring -r would be enough.

Sunday, March 1, 2009

Removing ^M characters in Unix

Its quite simple to do,but its pain when this stops the whole process of automation or development
If foo is the code in which you want to remove ^M
the command you just need is
cat foo | col -b > foo_update

or you can use dos2unix tools also,but the above case is when you dont have access to the dos2unix tools