7
2
I've written a little perl script that I invoke as follows:
perl -pe'...' <a
I wanted to copy the contents of the input file 'a' from a web browser (a whole wordpress blog entry, to be exact). The copy part works perfectly, the full contents show up in ClipMenu. But when I try to paste it into a file using cat and redirect:
cat >a
It emits exactly 1024 characters, then stops accepting input - only CTRL-C can help. I've tried pasting only 1023 bytes/chars, and that works, after pressing enter, I could enter it into the file without any problems. But if I entered 1024 chars on a single line, there was no way to do anything else other than CTRL-C.
I've tried iTerm and Terminal.app, both show the exact same behavior. I've tried bash from macports and /bin, with the exact same results. I've even tried dd:
dd bs=1M of=a
To the exact same result. Nothing seems to help.
I'm clueless - why does this happen? And how could I copy-paste into a file on Mac OS X easily, and in a way that I can be sure the contents are not altered in any way?
That last part is a completely separate question, right? – Daniel Beck – 2011-03-30T10:52:24.050
Well spotted, Daniel. It is sort of an explanation of the job I want to do, one way or another, that puts the question into perspective. – Agoston Horvath – 2011-03-30T10:57:34.373
2Separate questions should go into separate, well, questions on this site. A single "I have the following problems:" topic doesn't help anyone but the original poster (granted, your second question is harmless in comparison) -- you should probably focus on your 1024 character issue in this topic. I'm curious, why is it you want to paste exactly what the source contains? In the realm of text, you might end up with multiple incompatible character sets in the same file. – Daniel Beck – 2011-03-30T11:01:30.800
@Daniel: I was trying to fix links in the HTML version of a wordpress blog entry that have been vandalised by wordpress' buggy visual editor. Wordpress, firefox, iTerm and macos console all support unicode, so charsets are no problem. To do this, the most simplistic approach (without using any brainz) was to select the full blog entry, copy it to a file, execute perl script, and then copy it back. And then I've hit this weird issue that I've spent an hour trying to explain and google for, without any results. – Agoston Horvath – 2011-04-06T10:16:06.487