[clug] comparing the output of two saved 'ps' listings... 'watch' on saved files vs live cmd - possilbe?
sjenkin at canb.auug.org.au
Sat Dec 19 08:13:15 UTC 2015
worked a treat.
The -y & -z highlights were very good - the same sort of markup that ‘watch’ does.
I don’t need -1 or the -d options - ‘ps’ listings tend to be very similar, but never identical.
not that many processes remain ‘unchanged’ over time.
I run an Ubuntu LTS, so ‘wdiff’ is there in the repo.
Many thanks & Merry Christmas
> On 19 Dec 2015, at 1:13 PM, Francis Whittle <fj.whittle at gmail.com> wrote:
> After a little experimenting, I came up with a wdiff command:
> wdiff -1 -y `tput rev` -z `tput sgr0` -d <(diff -u ps1 ps2)
> -1 suppresses deletions, so you will only see the *new* pieces (I think this is how watch -d works)
> The tput commands are for turning reverse video on and off for insertions.
> "-d <(diff -u ps1 ps2)" is using the output of a unified diff to suppress contextually irrelevant lines that have not changed. You could just put the file names as arguments there to show the full list with changes highlighted.
> - Francis
Steve Jenkin, IT Systems and Design
0412 786 915 (+61 412 786 915)
PO Box 48, Kippax ACT 2615, AUSTRALIA
mailto:sjenkin at canb.auug.org.au http://members.tip.net.au/~sjenkin
More information about the linux