All Questions

Tagged with
Filter by
Sorted by
Tagged with
21 votes
7 answers
33k views

Read fixed width record from text file

I've got a text file full of records where each field in each record is a fixed width. My first approach would be to parse each record simply using string.Substring(). Is there a better way? For ...
Chris Karcher's user avatar
20 votes
10 answers
61k views

Parsing a fixed-width formatted file in Java

I've got a file from a vendor that has 115 fixed-width fields per line. How can I parse that file into the 115 fields so I can use them in my code? My first thought is just to make constants for each ...
MattGrommes's user avatar
  • 12.1k
8 votes
1 answer
12k views

Pandas read_fwf not Loading Entire Content of File

I have a rather large fixed-width file (~30M rows, 4gb) and when I attempted to create a DataFrame using pandas read_fwf() it only loaded a portion of the file, and was just curious if anyone has had ...
eroma934's user avatar
  • 339
6 votes
1 answer
3k views

Excel-like text import in Python: automatically parsing fixed width columns

In Excel, if you import whitespace delineated text in which the columns do not line up perfectly and data may be missing, like pH pKa/Em n(slope) 1000*chi2 vdw0 CYS-I0014_ ...
tel's user avatar
  • 13.8k
5 votes
3 answers
9k views

Parsing variable length strings of fixed column widths C#

I am trying to parse a text report that is formatted into columns. Each column appears to be right justified with a fixed length. For each line, there are times that not all the columns are used. In ...
Shawn's user avatar
  • 85
4 votes
4 answers
1k views

How to parse multiple line, fixed-width file in perl?

I have a file that I need to parse in the following format. (All delimiters are spaces): field name 1: Multiple word value. field name 2: Multiple word value along ...
NeonD's user avatar
  • 169
4 votes
1 answer
2k views

Measure field/column width in fixed width output - Finding delimiters? [closed]

In the context of the bash shell and command output: Is there a process/approach to help determine/measure the width of fields that appear to be fixed width? (apart from the mark one human eyeball ...
Chris's user avatar
  • 427
2 votes
1 answer
3k views

How do I use awk to parse a fixed-width (NACHA) file format?

My company has a problem: we suspect that the NACHA files we are receiving from one of our application service providers that we use to draw money from our clients are incorrect. We have all of the ...
atroon's user avatar
  • 133
1 vote
1 answer
798 views

Slow parsing of fixed-width, alternating-line file to pandas dataframe

I have written a function to parse this wind file (wind.txt ~1MB) into a pandas dataframe but it's pretty slow (according to my colleague) because of the nastiness of the file format. The file linked ...
Taylor's user avatar
  • 378
1 vote
1 answer
782 views

Is it possible to parse a fixed width file without knowing the width of each column or the column names and converting it to a CSV?

I was wondering if it's possible to parse any fixed width file without knowing anything about it and making it into a CSV. My intuition says no because there could be some edge cases. If you know the ...
John Lexus's user avatar
  • 3,358
1 vote
0 answers
431 views

Parse fixed-width file with RowProcessor (Univocity)

I'm dealing with a fixed-width file with 3 different types of bean : Bean 1 (header) : length = 256 ; starts with 0256Q ; one single header Bean 2 (record) : length = 768 ; starts with 0768T ; ...
Julie Lehninger's user avatar
1 vote
2 answers
1k views

Reading columnar text data files in Node.js

I am looking for a Node.js package that can parse text data files. The files are not delimited, but instead have the data running in columns. What is this type of file called? Block On Off Miles ...
Jon Wilson's user avatar
0 votes
2 answers
2k views

Parsing Cobol fields description from Java [closed]

I have to parse a text like this: 000001 01 ROUTINE_NAME. 000002 * ...
Vitaly Olegovitch's user avatar
0 votes
1 answer
121 views

Reading a fixed width file with Rust

I am trying to read a fixed width file with Rust, with the goal to load the data into a Polars dataframe, however, I can't parse the file correctly. I am trying to use the fixed_width crate as polars ...
YeO's user avatar
  • 1,030
0 votes
1 answer
184 views

Univocity master detail relationship beans

I have a fixed structured file like this 5 type records, GM, AB, TM, DM, IN TM and DM as you see is a master-detail relationship but also DM and IN are in a master-detail relationship GM01012020 ...
Mikey Margotrin's user avatar
0 votes
0 answers
3k views

Automate Text to Columns with the Fixed Width setting?

I am trying to automate the text to columns feature in Excel. I want to use the default settings Excel chooses in the Fixed Width setting, because it always chooses the correct breaks with my ...
Benji Kenobi's user avatar
0 votes
1 answer
510 views

parse a regular expression with fixed length pattern

Hi… i have a problem to parse a regular expression with fixed length pattern… assuming the following line… __active__ The node where the mouse pointer is currently located. start ...
Andreas Otto's user avatar
0 votes
0 answers
120 views

Parse fixed width content

Is it possible to parse fixed width content? I sketched the following, but it does not compile: grammar FixedWidth; content: name age birthday; name: character[10, false]; age: integer[2, false]; ...
guercheLE's user avatar