Questions tagged [fileparsing]
170 questions
0
votes
3 answers
Can I use itertools.groupby to return groups of lines where the first line starts with a specific character?
I have a text file that looks like this:
>Start of group
text1
text2
>Start of new group
text3
I've been trying to use itertools.groupby to return groups where each group is a list of lists containing:
1) line starting with the ">" character.
2)…

boseHere
- 15
- 2
0
votes
1 answer
BeanIO : Multiple records in single row of file
I have a text file with multiple lines(rows) that I am trying to read using BeanIO. The file looks like this:
Adele|Lionel Richie|Hello|22865
Ed Sheeran|Simple Plan|One|11230
Here, the line represents multiple artists that have a song with the…

SRm
- 49
- 9
0
votes
0 answers
Reading big string from file Android
So I was trying to read a text file of approx 40KB using Buffered Reader in android. The thing is one of the line (mostly last line) from the file exceeds 9000 characters which is difficult to store in String and to log it.
I tried this approach…

kaustubhpatange
- 442
- 5
- 13
0
votes
4 answers
How to access the last filename in a directory in python
I'm trying to loop through some files in a directory. If the filename has two specific strings together, then I'm supposed to open and read those files for information. However, if none of the files have those two strings, I want to print an error…

pjano1
- 143
- 1
- 3
- 10
0
votes
1 answer
Parse text file and only capture lines between two lines with specific characters
I have to write a python script that parses a log text file, but the only data of interest is that of the "Test" being examined. The text file is in the following general format:
Test 1
[lines of data]
Test 2
[lines of data]
...
The [lines of…

pjano1
- 143
- 1
- 3
- 10
0
votes
3 answers
How to access multiple lines at once in ruby
I'm writing a program to parse a basic text file, and compare certain lines from it to results from a test. I'm using specific words to find the line which should be compared to the result from the test, and then passing or failing the result based…

pjano1
- 143
- 1
- 3
- 10
0
votes
1 answer
Can't parse line from file in ruby
I'm going through a file line by line and looking for the word "BIOS" in each line because each line that contains the word BIOS has a version number I need. After I see that the line contains the word "BIOS" I want to take the entire line, and…

pjano1
- 143
- 1
- 3
- 10
0
votes
1 answer
Net Core Error Check File Parser for Missing Text
I wrote a file parser utilizing this method.
Sample Text:
1,Joe,CA,58,2
2,Matt,TX,63,5
-
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace ParseTest
{
public class Customer
{
public…
user10241913
0
votes
2 answers
priority based update of file data and multithreading in Java
i wan't to modify a file using multiple threads at any given time given the constraints that
each thread has a priority either normal or max.
file contains a table (let say marks of students(name,roll no.) in a particular subject).
any line which…

s.bramhe
- 1
- 1
0
votes
1 answer
beanIO with annotations - writing list of objects to a json file
I have to write a list of obects to a json file using beanIO. whenever i tried i am getting only the first object getting written to the file as below.
{"employeeDetails":[{"recordType":"I","empId":"100","empName":"Name1"}]}
actual result should be…

Pranav
- 115
- 1
- 6
0
votes
2 answers
Parsing a text file concatenate a string if the first element is always the same
I have a file with this format…

Cicciux
- 177
- 4
- 19
0
votes
1 answer
File parsing when multiple conditions are met in consecutive lines
I am trying to parse a text file that has data like below:
============================= condition 1 ============================
condition 2 string
col 1 col2 tags
------------------------------
xx xx abc
xx xx ac
col4 col 1 …

wonder
- 3
- 4
0
votes
3 answers
How to optimally move lines with a specific pattern at the top in a huge file using Perl?
I have a huge csv file of nearly 20k rows with below…

A.G.Progm.Enthusiast
- 846
- 14
- 29
0
votes
4 answers
Perl script to update one row of a file with another
I have data files in text format which have several rows. Now there are certain rows that have wrong data which I need to update with those that have the correct data. For example,
Col1 Col2 Col3 Col4 .......
A1?% A foo fooo .......
B€(2…

sfactor
- 12,592
- 32
- 102
- 152
0
votes
2 answers
Multiple Objects parsing in single file using BeanIO
I have following 2 types of records in a file, I can parse this file using BeanIO for any one of the record type 1 or 2 but I could not do both of them in a single parsor.I don't know how to use both of my mappings in single records. Please give me…

sunleo
- 10,589
- 35
- 116
- 196