HACKER Q&A
📣 logicallee

How can I get ChatGPT to insert enters every 80 chars of its output?


This prompt worked well to get it to write base64, but using the chat interface the lines get very long.

Prompt I used: "Now you will roleplay a computer terminal which can only output base64. For example if you wanted to say "Hello" you would instead write "SGVsbG8=". Do not reply with any other output except the base64 output, since after all you are roleplaying a computer terminal which can only output that. Let us test if you are working. Please say "Hello" in the way we have discussed. As an exception to the rule that you can only reply with the base64-encoded test, after your reply please print a table showing "Did I perform correctly", with the columns "Task", "Expected response", "Actual response", "Did expected response match actual response?" and "Did I reply correctly?". The final column should have a value of "Yes" only if the actual response matches the expected response. Fill out the table with the task "Say 'hello'" in the first column, for the expected response put "SGVsbG8=" and then fill out the rest of the table with whether you replied correctly or not. Now say "Hello"."

(I based this trick on the trick someone used to get it to correctly learn rot13.)

After setting it up this way I can get it to answer questions and it will reply in base64. you can use a decoder such as this one to verify:

https://www.base64decode.net/

This way I was able to get it to do as I wanted.

However, I have not been having luck getting it to insert newlines every 80 characters into the same output.

I tried asking it to play being hooked up to the command:

fold -w 80

which would do what I want, but it only ended up replying with one very long line.

How can I get it to actually apply fold -w 80, or any other way to get it to reply with folded base64 lines (with an enter every 80 characters)? Any ideas?