Category: Non-Gentoo
comment contest
This contest stems from David's post regarding a script to comment out words in a C file. The general applicability of this script is questionable, but it's still a fun exercise. Here are the instructions:
- Write a command-line filter which will comment out all matches of a pattern given on the command-line, reading a C program from stdin and filtering to stdout. Whether the pattern is a literal, glob, regular expression is up to the contestant.
- The filter should ignore matches that are already contained within a comment (including C++ style comments) or double-quoted string.
The existing gawk implementation on David's blog is an interesting starting point, though it doesn't fulfill all the requirements above.
Samples:
Adjusting Exif Date/Time with jhead
Working on some digital photos today, I found the Date/Time field in the Exif header was set to EDT, because that's how my camera was set (I've changed it now to UTC). This is problematic because I recently took a trip to Italy, and of course the times on those photos don't make sense:
$ jhead IMG_0356.JPG | grep ^Date Date/Time : 2005:09:20 09:46:49
To get the times changed to UTC on my existing pictures, I used the following sequence:
$ jhead -ta+4:00 *.JPG $ TZ=UTC jhead -ft */*.JPG
The first command advances the Exif Date/Time on all the pictures by 4 hours, which is the difference between EDT and UTC. The second command copies the Exif Date/Time to the file's mtime, pretending that we're presently in UTC so that it doesn't attempt to adjust. The final result is:
$ jhead IMG_0356.JPG | grep ^Date Date/Time : 2005:09:20 13:46:49 $ ls -l IMG_0356.JPG -rw-r--r-- 1 agriffis agriffis 3.9M Sep 20 09:46 IMG_0356.JPG