[comp.text] how to diff para oriented text

drstrip@intvax.UUCP (David R. Strip) (04/10/91)

Can someone point me to a utility, or set of
magic flags for diff that would allow useful
diff'ing of files that are paragraph oriented
(e.g., TeX input). If you diff files that have
been line wrapped, but otherwise unchanged you
get all kinds of "wrong" diffs in terms of what
I want. One crude hack would be to create
intermediate files of one word per line, then
use diff, but this would be pretty ugly and
lose a lot of context (visually, at lesat)
Thanks
strip
drstrip@cs.sandia.gov

cudcv@warwick.ac.uk (Rob McMahon) (04/11/91)

In article <3737@intvax.UUCP> drstrip@intvax.UUCP (David R. Strip) writes:
>Can someone point me to a utility, or set of magic flags for diff that would
>allow useful diff'ing of files that are paragraph oriented (e.g., TeX input).

There's a little utility called `spiff' which should be in the archives that
does this sort of thing.  It's main problem is that it can't deal with large
files, but it's quite good at what it does, here's an example of a spiff
between your the text of your original article and the above quote:

0a1,2
> _I_n_ _a_r_t_i_c_l_e_ _<_3_7_3_7_@_i_n_t_v_a_x_._U_U_C_P_>_ _d_r_s_t_r_i_p_@_i_n_t_v_a_x_._U_U_C_P_ _(_D_a_v_i_d_ _R_._ _S_t_r_i_p_)_ _w_r_i_t_e_s_:
> _>Can someone point me to a utility, or set of magic flags for diff that would
2a3
> _>allow useful diff'ing of files that are paragraph oriented (e.g., TeX input).
4,10d3
< (e.g., TeX input). _I_f_ _y_o_u_ _d_i_f_f_ _f_i_l_e_s_ _t_h_a_t_ _h_a_v_e
< _b_e_e_n_ _l_i_n_e_ _w_r_a_p_p_e_d_,_ _b_u_t_ _o_t_h_e_r_w_i_s_e_ _u_n_c_h_a_n_g_e_d_ _y_o_u
< _g_e_t_ _a_l_l_ _k_i_n_d_s_ _o_f_ _"_w_r_o_n_g_"_ _d_i_f_f_s_ _i_n_ _t_e_r_m_s_ _o_f_ _w_h_a_t
< _I_ _w_a_n_t_._ _O_n_e_ _c_r_u_d_e_ _h_a_c_k_ _w_o_u_l_d_ _b_e_ _t_o_ _c_r_e_a_t_e
< _i_n_t_e_r_m_e_d_i_a_t_e_ _f_i_l_e_s_ _o_f_ _o_n_e_ _w_o_r_d_ _p_e_r_ _l_i_n_e_,_ _t_h_e_n
< _u_s_e_ _d_i_f_f_,_ _b_u_t_ _t_h_i_s_ _w_o_u_l_d_ _b_e_ _p_r_e_t_t_y_ _u_g_l_y_ _a_n_d
< _l_o_s_e_ _a_ _l_o_t_ _o_f_ _c_o_n_t_e_x_t_ _(_v_i_s_u_a_l_l_y_,_ _a_t_ _l_e_s_a_t_)

Rob
-- 
UUCP:   ...!mcsun!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv@uk.ac.warwick             INET:   cudcv@warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England