Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Debian GNU/Linux Reference Guide
Prev Home Next

8.6.12 Convert a text file with recode

Following will convert text files between DOS, Mac, and Unix line ending styles:

     $ recode /cl../cr <dos.txt >mac.txt
     $ recode /cr.. <mac.txt >unix.txt
     $ recode ../cl <unix.txt >dos.txt

Free recode converts files between various character sets and surfaces with:

     $ recode charset1/surface1..charset2/surface2 \
       <input.txt >output.txt

Common character sets used are (see also Introduction to locales, Section 9.7.3) [ 37] :

  • us — ASCII (7 bits)

  • l1 — ISO Latin-1 (ISO-8859-1, Western Europe, 8 bits)

  • EUCJP — EUC-JP for Japanese (Unix)

  • SJIS — Shift-JIS for Japanese (Microsoft)

  • ISO2022JP — Mail encoding for Japanese (7 bits)

  • u2 — UCS-2 (Universal Character Set, 2 bytes)

  • u8 — UTF-8 (Universal Transformation Format, 8 bits)

Common surfaces used are [ 38] :

  • /cr — Carriage return as end of line (Mac text)

  • /cl — Carriage return line feed as end of line (DOS text)

  • / — Line feed as end of line (Unix text)

  • /d1 — Human readable bytewise decimal dump

  • /x1 — Human readable bytewise hexidecimal dump

  • /64 — Base64 encoded text

  • /QP — Quoted-Printable encoded text

For more, see pertinent description in the info recode.

There are also more specialized conversion tools:

  • character set conversion:

    • iconv — locale encoding conversions

    • konwert — fancy encoding conversions

  • binary file conversion:

    • uuencode and uudecode — for Unix.

    • mimencode — for the mail.


Debian GNU/Linux Reference Guide
Prev Home Next

 
 
  Published under the terms of the GNU General Public License Design by Interspire