patch command display redirect to file?

Title pretty much says it.

But how can the patch command display output, not the file patch output, be redirected or tee'd to a file.

I've tried piping to tee and redirection '>' but to no avail. File gets created but is empty and output is on screen only.
 
UNIXgod said:
Are you trying to output diff to a file?

% diff -u file alteredfile > newfile.patch

No.

Want the displayed output of patch command (status of patches; success, ignored, etc.) redirected or tee'd to a file. Not the patch itself.
 
$ patch -p0 -i patchfile

Where patchfile is a unified diff

Want the "DISPLAYED OUTPUT", not the diff or patched file, either redirected or tee'd to a file.
 
Have you tried redirecting both stdout and stderr?

For sh-based shells:
# patch -p0 -i patchfile > output.txt 2>$1
 
phoenix said:
Have you tried redirecting both stdout and stderr?

For sh-based shells:
# patch -p0 -i patchfile > output.txt 2>$1

[cmd=:]patch -p0 -i patchfile > output.txt 2>$1
Ambiguous output redirect.
[/cmd]
 
NOYB said:
[cmd=:]patch -p0 -i patchfile > output.txt 2>$1
Ambiguous output redirect.
[/cmd]
This redirection syntax depends on your shell.
For example with sh(1) it is (& instead of $):
% patch -p0 -i patchfile > output.txt 2>[b]&[/b]1
If you are using csh(1)/tcsh(1) (which is quite probable on FreeBSD) then it is something completely different. Consult the manpages.
 
jalla said:
Code:
patch < x.diff >& patch.log

Thank you. :)

Changed the redirection to a pipe to tee for screen and log file output.

patch -p0 -i unified_diff_file |& tee patch.log
 
Back
Top