This one has been driving myself and the web developer crazy:
I have a Mac FileMaker database that exports a text file that is used to feed the display of a web site.
Previously an Excel Macro under windows created the text file. That text file works fine, and my FileMaker exports looks no different cosmetically than the original Windows file.
The problem is, the import routine on the web-end needs the Windows-style CRLF (carriage return and line feed) line endings. I’ve tried to get AppleScript to put the codes in via TID (ASCII character 13 & ASCII character 10, or “/r/n”) but it doesn’t seem to work (the developer’s script still not working…reads my data as one huge record).
When he converts my fle manually with Coda, all is well.
My FileMaker-generated file uses “/r” as the line ending.
I tried it via command-line (using do shell, which is where the AppleScript comes in), but not making any progress either, probably because I don’t understand what I’m doing:
Got this off the web for UNIX-to-Windows conversions:
awk 'sub("$", "\r")' unixfile.txt > winfile.txt
(suspicious of this one because I don’t see the “/n” Windows needs)
Thought I was going somewhere with this, but Mac doesn’t seem to have a command-line Perl?
perl -p -e 's/\n/\r\n/' < unixfile.txt > winfile.txt
Found some Perl scripts that can be turned into command-line executables, but I know less about working with Perl than I do about the command line in general.
THE IDEA, is I get this working so FileMaker can kick-off the script to “repair” it’s own exports. It currently does this to convert “vertical tab” (it’s native record delimiter) to a Mac-style “return” (/r).
Okay, my head hurts just explaining all that.
SHORT FORM: need a command-line way to convert Mac line-endings to Window-style line endings.