+Larry #1 Posted December 29, 2013 Does anyone know of a good text file converter to "cut" 80-column files down to 40-column? Have some PC text files I'd like to convert to Atari format without completely manually editing them. Thanks, Larry Quote Share this post Link to post Share on other sites
Rybags #2 Posted December 29, 2013 Haven't had the need for that sort of stuff for decades. Fairly sure a short computing project back at school was to do that sort of thing, ie - keep track of most recent end-of-word and do line truncation there if the next word exceeded your set limit. You can do that sort of thing in Basic, turbo mode in emulation a big help. Potential problem though is that you still have the CR/LF from 80 column truncation and you'll likely end up with a bunch of lines somewhat shorter than they could potentially be. But really, no matter what you do, the result will probably need a bit of massaging to make it look the way you want. Quote Share this post Link to post Share on other sites
Irgendwer #3 Posted December 29, 2013 (edited) Does anyone know of a good text file converter to "cut" 80-column files down to 40-column? Have some PC text files I'd like to convert to Atari format without completely manually editing them. You could use a text editor like "jEdit", select 40 chars wrap width as buffer option, select all and choose "Format paragraph". If you just like to browse/read the files on your Atari, you could use "Seitensprung" which not only supports CR/LF but also wraps the text around. Edited December 29, 2013 by Irgendwer Quote Share this post Link to post Share on other sites
Sikor #4 Posted December 29, 2013 Try put it to "First XL-ent". CR/LF can be problem, but i think than "Panther" text editor would be ok for this. Or use simple Turbo Basic XL procedure like this (I dont try it): 99 -- 100 PROC CONVERT 101 O.#1,4,0,"PC_TEXT":O.#2,8,0,"ATARI_TEXT":.PC_TEXT AND ATARI_TEXT IS VALID PATH TO TEXTES 102 FOR I=%0 TO 39:.LINE WIDTH IS 40 CHAR 103 TRAP 200:.IF WILL BE ANY ERROR OR EOF 104 GET#1,A:.GET SOURCE 105 IF A=13:GET#1,A:PUT#2,155:I=39:G.102:.13 10 IS CODE FOR CR/LF - IT IS THAT SAME THAN ATARI 155 CODE 106 PUT #2,A:.SAVE LETTER TO ATARI FILE 107 N.I 108 G. 102 110 ENDPROC 200 CL.:END Good luck. Quote Share this post Link to post Share on other sites
+Roydea6 #5 Posted December 29, 2013 Larry, Are these Text files already on your PC if so most of the modern Text file editors have a wrap at screen borders and convert WRAPS to CR/LF, so just set your screen size to 39 and Wrap and set CR/LF. Even the file by Flashjazzcat The Last Word has a macro for putting a carriage return at the screen border.. Just make screen width 40 or what ever and issue the Macro command. 1 Quote Share this post Link to post Share on other sites
+Larry #6 Posted December 29, 2013 Thanks guys. I like the PC solution best -- should have thought of that, but didn't. I set WORD's right margin to 4.5" and then saved it as text with CR/LF on each line. Works like a charm. No split words, etc. Minimal "tweaking." I was hoping not to reinvent the wheel, and thanks to this procedure, didn't! -Larry Quote Share this post Link to post Share on other sites
+Stephen #7 Posted December 29, 2013 If you are not opposed to SDX, there is a way to do it using the FMT command. FMT (Format Text) CommandPurposeSimple text formatter.SyntaxFMT [/s|J] fname[.ext] [ncol]FMT[/s|J] <<fname[.ext]TypeExternal - on device CAR:RelatedMAN, MORE, LESS, TYPEAvailabilityAs of SpartaDOS X 4.42.RemarksThis is a simple text formatter, which reads the input line by line andapplies to each one:• Spaces at the beginning of the line are removed.• '/S' switch: Multiple spaces are turned into one single space.• If the resulting line is longer than 'ncol' characters, it will be folded.• '/J' switch: The line gets justified to both margins, unless it contains anEOL character at the end.The 'ncol' value may not be less than 32 or more than 127. When 'ncol'was not specified, the current screen width is assumed.The line folding and justification works best, when the text is prepared sothat single paragraphs (no matter how long) are terminated by one ortwo EOL characters, but do not contain EOLs themselves (continuoustext). In other words, the text should not have been broken into lines. Toprepare such a file a text editor can be used that can do proper linewrapping and does not enforce terminating each line with the Return key– e.g. "First XLEnt Wordprocessor".FMT is a filter command that can receive data from a pipe. Its primarypurpose is helping to format documentation files for the MAN command.764 The Command Processor – CommandsFor example, if you want to print one of the help files (say HELP.DOC) onpaper in 80 columns and justified form, do this:MAN HELP /P | FMT /S /J - 80 >>PRN:If the text was not prepared according to the remarks above, it is a goodidea to preview the FMT output on the screen first.Chapter 5 contains more information on pipes. Quote Share this post Link to post Share on other sites
+Larry #8 Posted December 30, 2013 Thanks, Stephen. I do appreciate your post and the info. I'm not a SDX user, but I've bookmarked this thread in case it comes in handy in the future. -Larry Quote Share this post Link to post Share on other sites
UNIXcoffee928 #9 Posted December 30, 2013 No, no, no! Automate it. Always Automate it! Use fold, fmt, or par. Readily available for UNIX, Linux, Macs... If you still use windows, there is a Windoze port for par, here, and there are likely ports for fold & fmt, if you go looking with your favorite search engine. ...if you need to compile any source try the Digital Mars ANSI C compiler for Windows, and it may do the trick. Look up sed, awk, and grep, while you're at it... Never do a gazillion things by hand. Remember, if you have to do anything more than once or twice, automate it! Don't forget to create a new directory, and copy everything that you want to modify into that directory, before you get started modifying your text files. You may find that diff (or windiff) will help you out, as a check, to ensure that everything went as you expected it to. Enjoy. 1 Quote Share this post Link to post Share on other sites