Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Change copyright from 2013 to 2012
Copy link

brendanfalkowski commented Nov 4, 2013

Thanks Alan, traced those files down:

  1. Without inspecting what went wrong, I can see these aren't files I'll need to merge/update in custom work. So it's a quick way to isolate them.
  2. The first two bugging files contain comments written in Italian and Spanish that use accented characters. I'm guessing the UTF-8 chars are what's causing sed to choke. I didn't notice anything like that in the next two, but it's probably a similar problem.

Regardless, we can use this to rule out the files that can't be processed with sed but are valid file types.

Updated my gist with this info:

Copy link

astorm commented Nov 4, 2013

One last follow up. It's not strictly UTF-8 characters that are tripping up sed. Per the previous Stack Overflow questions, sed will obey the encoding set in

$ echo $LANG

That means it's fine with UTF-8. The "real" problem is those files aren't UTF-8 encoded. BBEdit reports them as "Western (Max OS Roman)" on my system (— but text encoding is complicated).

So, a better explanation of what's going wrong is those files contain characters that aren't technically valid for their encoding. Our text editors and browsers have heuristics to do something smart when they encounters this — but sed's a tool written by c programmers to operate directly on bitstreams (sed stands for stream editor). When sed encounters those characters, it gets upset and bails rather than making a wrong "heuristical" guess.

Ultimately not useful to our task at hand, but interesting if you're interested in C programming.

Copy link

rtull commented Sep 5, 2014

If all you're needing is a diff, try this:

diff -qrI '@copyright' /path/to/mage-v1 /path/to/mage-v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment