Useful bash helpers
Diff two files with long lines
I wrote this function when I wanted to compare the build output for an angular project.
Super long lines were what I had to battle with, fold --spaces helps with that.
The output was easier to read with diff’s --side-by-side and --suppress-common-lines cuts
it down to only the parts that changed. For a longer comparison piping the output to less -r
does wonders.
function difflonglines {
colordiff --side-by-side --suppress-common-lines ${@:3} <(fold --spaces $1) <(fold --spaces $2)
}
