Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 863913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:23:19+00:00 2026-05-15T09:23:19+00:00

I get files in different formats coming from different systems that I need to

  • 0

I get files in different formats coming from different systems that I need to import into our database. Part of the import process it to check the line length to make sure the format is correct.
We seem to be having issues with files coming from UNIX systems where one character is added. I suspect this is due to the return carriage being encoded differently on UNIX and windows platform.

Is there a way to detect on which file system a file was created, other than checking the last character on the line? Or maybe a way of reading the files as text and not binary which I suspect is the issue?

Thanks Guys !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:23:20+00:00Added an answer on May 15, 2026 at 9:23 am

    Unix systems use \n line endings while windows uses \r\n and mac uses \r.
    You cannot detect the file system since it doesn’t matter at all. I can use \n on windows if my editor supports it for example. It’s just the standard on those OS, not a requirement.

    The proper way – assuming you don’t have a function which properly tokenizes no matter what line ending the file uses – is to search for a \n OR a \r and then end the current line and strip all chars from the remaining data which are either \r or \n before you begin the next line.
    However, this will cause issues if you have blank lines and need to keep them. In this case you have to look at linebreaks more carefully:

    • when reading a \n, end the current line and start the next line
    • when reading a \r, end the current line and, if the next char is \n, skip it, and start the next line, otherwise start the new line immediately.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We get a large amount of data from our clients in pdf files in
For some solutions, when I open them Visual Studio will get files that aren't
I want to get an overview of files that are updated in TFS (that
I'm using the OleDB DataReader to get data from my excel files (but this
I am trying to import various pipe delimited files using php 5.2 into a
I want to get a files these attributes as integer values.
We have a project with many dll files which get loaded when the application
Is there any Perl script to read multiple PDF files and get the number
We get these ~50GB data files consisting of 16 byte codes, and I want
How do I get a list of all files (and directories) in a given

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.