5

I have got head ache to parse a text file with out delimiter ...........

Comments
  • 2
    Then how is it formatted?
  • 1
    I even not getting the solution
    I have a table format in the text file but no two columns didn't have a specific separator even space or tab each column is different and each row is different in columns even data may be empty
  • 2
    @NaveenValluru are you showing all characters? So spaces are a dot, tabs are arrows, null characters also show null etc.
  • 1
    @Codex404 no I am showing only one character dot ie space no other character some are divided by one dot and other by two or three
  • 1
    @NaveenValluru are those with two space a column missing a column?

    And enable showing hidden characters, that really helps a lot.
  • 1
    @Codex404 Thanks a lot for trying to solve my problem but here not the case some columns are separated by two spaces some are one and some are three and more
  • 1
    Without examples it's hard to help you, but it's the typical problem where regular expressions are the solution (and not a new problem 😄)
  • 2
    @nbamaral yeah it's true with out example it's difficult but the file is a bank statement given by my boss .
    Thanks for idea of (reg exp)
  • 0
    @nbamaral its the typical problem you dont use regex.
  • 0
    @Codex404 I will share you the example here
  • 0
  • 0
    @nbamaral big inconsistent things parsing will make your regex almost custom made to fit a certain line, when a new file comes in the regex will have to be written again.
  • 0
    @Codex404
    Or you could add another one? Why use just one big complicated one when you can compile little blocks and then use those to compose more regexes.
    At least that's how I would do this kind of parsing
  • 0
    @nbamaral then it would be easier to replace the invonsistent seperators and make it a csv, open with excel and manually fix the few columns that are fucked.
Add Comment