Sample Header Ad - 728x90

How to compare minimised JS files with very long lines? diff prints whole lines which is unreadable (400k characters per line)

1 vote
1 answer
775 views
I need to compare two "minimised", very similar JavaScript files. Minimisation means that (among other things) newline and space characters that are not needed for interpretation by a computer are removed. The files therefore have lines up to >400000 characters per line. I do not maintain these files and cannot change that they are minimised. How can I diff / show the differences between these very similar files, only showing the changed/added words, perhaps with 10 characters of context? Environment: This is on a server so I cannot install special tools or software for this comparison and we need to work with standard "onboard" tools please. It is a CentOS server so we have gawk, POSIX/GNU tools etc. as well as perl, php and python. It's just that I cannot install a package or clone a big git repo for this simple task. We use the tcsh for most of our work so if the Answer could work without the special syntax of particular, other shells that would preferable as it would make the solution more easily accessible.
Asked by Ned64 (9256 rep)
Jan 9, 2024, 11:04 PM
Last activity: Jan 10, 2024, 06:37 PM