Questions tagged [fileparsing]

170 questions
3
votes
3 answers

What is the best way to read a text file two lines at a time in Java?

BufferedReader in; String line; while ((line = in.readLine() != null) { processor.doStuffWith(line); } This is how I would process a file line-by-line. In this case, however, I want to send two lines of text to the processor in every…
Ross
  • 9,652
  • 8
  • 35
  • 35
3
votes
1 answer

Share objects between celery tasks

I have got a program that handle about 500 000 files {Ai} and for each file, it will fetch a definition {Di} for the parsing. For now, each file {Ai} is parsed by a dedicated celery task and each time the definition file {Di} is parsed again to…
Ali SAID OMAR
  • 6,404
  • 8
  • 39
  • 56
3
votes
3 answers

Parsing newline delimited file

I'm working on a project where I want to parse a text file using Python. The file consists of some data entry in formats of blocks that vary. A new entry is found when there is a new line. This is what I would like to accomplish: Skip the first few…
who_lee_oh
  • 119
  • 1
  • 2
  • 9
3
votes
2 answers

Binary Reading of Bytes Returning only One Value. C#

The console displays 0,0,0,0 when I am expecting 0,1,2,3. This is a modified version of: https://msdn.microsoft.com/en-us/library/system.io.binarywriter(v=vs.110).aspx using System; using System.IO; namespace testingfilereadwrite { class…
UpTide
  • 307
  • 3
  • 13
3
votes
2 answers

Cleanest Perl parser for Makefile-like continuation lines

A perl script I'm writing needs to parse a file that has continuation lines like a Makefile. i.e. lines that begin with whitespace are part of the previous line. I wrote the code below but don't feel like it is very clean or perl-ish (heck, it…
TomOnTime
  • 4,175
  • 4
  • 36
  • 39
2
votes
2 answers

C: File parsing without losing white space

I am parsing a file for particular keyword matching by C program, here is my sample code... #include int main() { FILE *infile = fopen("Somefile.txt", "r"); char buffer[256]; char value[128]; while (fgets(buffer,…
Nimit
  • 1,714
  • 3
  • 22
  • 33
2
votes
2 answers

How can I run compare content in a Variable against a hashtable on PowerShell

I have a hashtable as below: $ProjectType = @{ CSharp = 'FAE04EC0-301F-11D3-BF4B-00C04F79EFBC' Web_Application = '349C5851-65DF-11DA-9384-00065B846F21' Windows_Communication_Foundation =…
2
votes
0 answers

How to parse a txt-file and then send it via multi-part?

I am trying to change a file, uploaded to form via user, before being sent to server via POST and multipart (I inactivate the button until all file is parsed fully). Is there a way to change the uploaded file ( i call it newFile below) in the form?…
Sturm
  • 93
  • 1
  • 7
2
votes
1 answer

My code is reading in the last variable in line and the first variable in the next line (in a text file) as a single element?

This (title) is happening for some reason. I have a text file like this: 5 H H H H H V H H H H H X X X X H D H H H H H H H X I parsed the file with input.useDelimiter(" "); I read in and store the number on line 1 in a…
cplusalex
  • 83
  • 4
2
votes
6 answers

Parsing a Quickbook IIF format file

I'm working with Quickbook's IIF file format and I need to write a parser to read and write IIF files and I'm running into some issues reading the files. The files are simple, they're tab deliminated. Every line is either a table definition or a…
Malfist
  • 31,179
  • 61
  • 182
  • 269
2
votes
4 answers

What's the best way to match strings in a file to case class in Scala?

We have a file that contains data that we want to match to a case class. I know enough to brute force it but looking for an idiomatic way in scala. Given File: #record name:John Doe age: 34 #record name: Smith Holy age: 33 # some…
dlite922
  • 1,924
  • 3
  • 24
  • 60
2
votes
2 answers

Displaying multiframe dicom images using HTML5 canvas and Javascript

I'm trying to display multi-frame dicom images in a browser using HTML5 canvas and javascript. So far I can render single framed images just fine but I'm having trouble with multi framed images. For parsing the file I'm using the DicomParser…
James M
  • 209
  • 4
  • 10
2
votes
1 answer

Generate binary file with given structure

I have a device witch use binary format style config, and i have to generate that files on-the-fly. File structure must consist of a number of configuration settings (1 per parameter) each of the form: Type Length Value where: Type: is a…
canni
  • 5,737
  • 9
  • 46
  • 68
2
votes
0 answers

How to validate cvs file header in apache Apache Commons CVS

I want to parse a CVS file using Apache Commons CVS. And there may be a scenario where user passed the wrong header row say 5 instead of 1. Is there any way to validate the header row passed to cvsParser if contains all Strings and not some other…
Rama Arjun
  • 273
  • 2
  • 3
  • 15
2
votes
3 answers

Print a string that contains a certain pattern in Java

I am trying to find a regular expression within a line of a .csv file, so I can eventually save all the matches to another file, and lose all the other junk. So a line in my file might look like: MachineName,User,IP,VariableData,Location The…
jjpotter
  • 45
  • 4
1
2
3
11 12