dos ttxt file line ends?

Discussion in 'Mac Programming' started by BabaG, Aug 15, 2008.

  1. BabaG macrumors member

    Jan 5, 2007
    i have a bash script i'm moving over to my macpro from a linux box.
    the script reads a windows-generated txt file. on the linux box i had
    to run the txt file through a program called dos2unix to change the
    dos style line endings to unix style. do i need to do something like
    this to properly read the txt file on the mac (10.4.11)? if so, what's
    the app i need to run it through and does it come with osx?

  2. kainjow Moderator emeritus


    Jun 15, 2000
    I don't think you would need to. I just tested with a file using Windows line endings and using the "cat" command it outputted just fine.
  3. BabaG thread starter macrumors member

    Jan 5, 2007
    thanks kainjow.

    i have lines in the script that call for specified line lengths from the
    txt file. when i had this script on linux, the file would output ok but,
    when looking for the specified line of the specified length, it would
    not find it because the dos line ending caused it to either have an
    extra character or be missing an extra character, i forget which.
    bottom line was, it would output ok but counted characters incorrectly.
    that's what i'm trying to avoid going through again now that it's
    moving over to osx. so, i'm not sure output is enough of a test.

    thanks again,

Share This Page