Questions tagged [file-processing]

333 questions
0
votes
2 answers

Reading and writting a large file using Java NIO

How can I effectively read from a large file and write bulk data into a file using the Java NIO framework. I'm working with ByteBuffer and FileChannel and had tried something like below: public static void main(String[] args) { String inFileStr…
KayV
  • 12,987
  • 11
  • 98
  • 148
0
votes
1 answer

How to read Data via a Future using file channels?

I am reading a file using RandomFileAccess, FileChannel and ByteBuffer as follows: RandomAccessFile myFile = new RandomAccessFile("/Users/****/Documents/a.txt", "rw"); FileChannel myInChannel = myFile.getChannel(); ByteBuffer bb =…
KayV
  • 12,987
  • 11
  • 98
  • 148
0
votes
0 answers

Awk to read variables from several files

I have 170 files in .t2 format that I'm trying to extract some variables. Here is the command I used. awk '{x[$1 "\t" $2]+=$8;}END{for(i in x)print x[i];}' *.t2>volume.txt The problem is it doesn't write anything to output file. When I tried one…
mtm
  • 1
0
votes
2 answers

BASH - remove line if first column content appears in another file

If I have two files. File A looks like: a 1 a 2 a 3 b 4 c 5 and I have file B which has content: a b For everything that appears in file B and also appears in column 1 in file A, I would like to remove those lines. So the expected output for file…
Shirley Du
  • 45
  • 8
0
votes
1 answer

issue with recursive file search in python3

I was making a function that recursively searches directories for files with a particular suffixes. TypeError: slice indices must be integers or None or have an index method pointing to this line: if path.endswith('.',sf)==True:…
user58641
  • 3
  • 2
0
votes
4 answers

C# how to read 2 files using Stream and response both as 1

I need to read 2 files and somehow combine them and response them both as 1. I don't want to create a new file containing both files text. This is my code to response my main file, FileStream fs = File.OpenRead(string.Format("{0}/neg.acc", …
barak
  • 147
  • 1
  • 3
  • 17
0
votes
3 answers

php getting count as per flags from text file

I am making a log file which logs in the following manner: [08-12-2016 22:59:38.000000] [Error] Testing [08-12-2016 22:59:45.000000] [Error] Testing [08-12-2016 23:03:37.000000] [warning] Testing I am trying to make a function which can read total…
danny
  • 407
  • 1
  • 5
  • 10
0
votes
0 answers

C# design strategy to read different excel sheets with an excel processor

I have a class to process an excel file, with multiple sheets. The class is called ExcelFileProcessor (inherits from IFileProcessor). My current implementation is within the ExcelFileProcessor class, I have different methods to process different…
devC
  • 1,384
  • 5
  • 32
  • 56
0
votes
0 answers

read two files from command line and compare the size of two files

I was creating a c program to read two files from the argument from the command line and compare the size of the two files Here's what I coded #include #include int main (int argc, char *argv[]){ FILE *file1, *file2; int…
Zhou Jie
  • 31
  • 1
  • 1
  • 2
0
votes
4 answers

Read text file into dictionary to be used later for adding/modifying/deleting

Let me preface by saying I'm not 100% sure if using a dictionary is the best course of action for this task but that is what I believe I need to use to accomplish this. I have a .txt file that is formatted like this: first_name last_name rate…
ByteSettlement
  • 208
  • 1
  • 3
  • 14
0
votes
1 answer

Multi-threaded file processing and database batch insertions

I have an Java main application which will read a file, line-by-line. Each line represents subscriber data. name, email, mobile, ... An subscriber object is created for each line being processed and then this object is persisted in database using…
0
votes
0 answers

Manipulating output from .exe via python script

Does anyone know if it is possible to manipulate the output of an exe when calling it from the native os module in python? For example suppose we have some executable, call it example.exe, and when it is executed it asks the user for input, a file…
Cauchy
  • 71
  • 6
0
votes
4 answers

How to grep for a pattern in a file and store the content following it?

My file content is blablabla Name : 'XYZ' Age : '30' Place : 'ABCD' blablabla How can I grep for "Name", "Age", "Place" and store name "XYZ", age "30" and place "ABCD" in a hash? What should be the '?' in this code to get…
Navaneeth Cp
  • 31
  • 3
  • 9
0
votes
2 answers

How to copy contents of a text file to a variable over a telnet session using python

I have the following program where I'm redirecting an output on terminal to a text file : import telnetlib import time import string tn = telnetlib.Telnet("192.168.1.102") print "Attempting Telnet connection...." tn.read_until("login:…
skrowten_hermit
  • 437
  • 3
  • 11
  • 28
0
votes
1 answer

How to detect disk full during write operation with Java nio?

I would like to write a file that comes from over a network, so I don't know the size of the file that's comming in. Sometimes the disk on the file server might get filled up and I would like return a message to my client notifying them of this…
kenny
  • 75
  • 1
  • 6