The first:
Edit a text file full of characters like so:
abcd1234./
I want to detect the lower case letter, and put it inside brackets with its upper case counterpart:
[aA][bB][cC][dD]1234./
Someone recommended I do a bash script, however I have no idea how to do this. I can understand if-then statements (if the character is "a", insert "A", then insert "][", read next letter), but I don't even know where to start with reading and editing bytes in a file.
The second program is probably pointless, just something I'd like to do:
Open an image/text file, then count the number of colors in an image and how many times it is used. It would be editing a huge bitmap file (usually not over 2 megapixels, or 6 megabytes). What I'd like to happen is have the program read 3 bytes, then store it in a couter, read the next 3, and add to the counter if that color was used before.
The output would be in a txt file with a 3 byte color, then the number of pixels using that color.
I realize it's not efficient, nor is it ideal, but it's about all I can handle, and I can always leave my computer on for a few hours to let it process everything, since I know it's going to be super slow.
If there's a better way that doesn't involve something ridiculously convoluted, I'd like to know, and how to make it.
"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"