LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   converting Windows text to Linux text (https://www.linuxquestions.org/questions/linux-software-2/converting-windows-text-to-linux-text-362379/)

joshknape 09-11-2005 12:30 PM

converting Windows text to Linux text
 
Is there any way to convert a large number of Windows text (Notepad) files at once to the Linux text format? I'm going to move all my text files over, and I'd rather not clean them up one by one.

mstep 09-11-2005 12:36 PM

I always thought the formats were identical. Have you tried creating a test file in windows notepad and opening it in linux to check?

aysiu 09-11-2005 12:51 PM

I was under that impression as well, since I often edit in Linux text-only files stored on my Windows FAT32 partition. What happens when you open the "Windows text" in Linux?

Snowbat 09-11-2005 12:52 PM

You can do it by directory with the following. Adjust input and output directories as required. I've used a sed method from http://www.student.northpark.edu/pem...d/sed1line.txt instead of dos2unix.

cd /mnt/windows/Windows/; for i in *.txt; do cat $i | sed 's/.$//' > /home/josh/$i; done


mstep: Linux uses (LF) to mark end of lines. DOS/Windows use (CR)(LF), and Macs just to be different use (CR). The usual complaint you hear about this is that in Windows Notepad, Linux text files show all on a single line with squares showing where the lines should end.


All times are GMT -5. The time now is 04:39 PM.