textfiles

Can't Separate Text File By Delimiter |

Hello, I am using C#. I am trying to pull in a text file to an object. I am using an ODBC connection and it looks like this Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=C:\Users\Owner\Desktop\IR\IR_Files\Absolute;Extensions=asc,csv,tab,txt; I am able to make the connection but I can't get my columns separated. I'm using a schema...

What to choose to store just one integer? Sqlite? or Text file?

I've build a small web-service in PHP. I want to control the number of calls to a specific API method. I thought at first of using a text file, because it's just an integer. But after taking a good look at SQLite it seemed much more convenient. So the code is just: get the "counter" from SQLite and increment it when that method is calle...

Downloading files from remote server

Hello, I am using C# and a console app and I am using this script to download files from a remote server. There area a couple of things I want to add. First, when it writes to a file, it doesn't take into consideration a newline. This seems to run a certain amount of bytes and then goes to a newline. I would like it to keep the same for...

C++ string parsing (python style)

I love how in python I can do something like: points = [] for line in open("data.txt"): a,b,c = map(float, line.split(',')) points += [(a,b,c)] Basically it's reading a list of lines where each one represents a point in 3D space, the point is represented as three numbers separated by commas How can this be done in C++ without...

Creating xml files from a database or list of variables.

I have a template and need to create several xml files. The file contains one variable -this- to replace several times, save it as that name -this-.xml and then repeat for each of the values in my text or excel list or from a database - How would I best go about doing this? ...

Easiest way to add a text to the beginning of another text file in Command Line (Windows)

What is the easiest way to add a text to the beginning of another text file in Command Line (Windows)? ...

python opens text file with a space between every character

Whenever I try to open a .csv file with the python command fread = open('input.csv', 'r') it always opens the file with spaces between every single character. I'm guessing it's something wrong with the text file because I can open other text files with the same command and they are loaded correctly. Does anyone know why a text file wou...

python: how to jump to a particular line in a huge text file?

Are there any alternatives to the code below: startFromLine = 141978 # or whatever line I need to jump to urlsfile = open(filename, "rb", 0) linesCounter = 1 for line in urlsfile: if linesCounter > startFromLine: DoSomethingWithThisLine(line) linesCounter += 1 if I'm processing a huge text file (~15MB) with lines o...

[C++] Detect newline byte from filestream

I'm trying to collect information from a textfile which contains names of organisations (without spaces) and floating integers. I want to store this information in an array structure. The problem I'm having so far is collecting the information. Here is a sample of the textfile: CBA 12.3 4.5 7.5 2.9 4.1 TLS ...

How to delete a line from a text file in C#?

Hello, I have a problem: how can I delete a line from a text file in C#? ...

What is the fastest way to load data into a ORACLE database with .NET?

I currently have a daily process that loads a large amount of data from a TXT file into a ORACLE database, using a shell script that calls sql_loader. I want to migrate that to a .NET service, but don't want to rely on executing sql_loader from my service. What is the best (and fastest) way to accomplish that? ...

Can I transpose a file in vim?

I know I can use awk but I am on a windows box I am making a function for others that may not have awk. I also know I can write a C program but I would love not have to create maintain and compile something for a little vim utility I am making. THe original file might be THE DAY WAS LONG THE WAY WAS FAST and it would become TT H...

Why should files end with a newline?

I assume everyone here is familiar with the adage that all text files should end with a newline. I've known of this "rule" for years but I've always wondered — why? ...

send a file to client

I want to write a text file in the server through Php, and have the client to download that file. How would i do that? Essentially the client should be able to download the file from the server. ...

Delphi - Sharing violation opening text file

I'm trying to open a text file for reading in a Delphi 7 app, but am getting I/O error 32 (sharing violation) because another application already has the file open. I've tried setting FileMode to "fmOpenRead or fmShareDenyNone" but now realise this doesn't apply to text files anyway. Is there a way of reading text files that are open by...

VB Script Text File Prepend

Anyone know how to quickly prepend (add two new lines of text) to the start of an existing text file using either VB Script or a Bat file? Most elegant solution gets the tick. ...

How to get line count cheaply in Python?

I need to get a line count of a large file (hundreds of thousands of lines) in python. What is the most efficient way both memory- and time-wise? At the moment I do: def file_len(fname): with open(fname) as f: for i, l in enumerate(f): pass return i + 1 is it possible to do any better? ...

Is it possible to speed-up python IO?

Consider this python program: import sys lc = 0 for line in open(sys.argv[1]): lc = lc + 1 print lc, sys.argv[1] Running it on my 6GB text file, it completes in ~ 2minutes. Question: is it possible to go faster? Note that the same time is required by: wc -l myfile.txt so, I suspect the anwer to my quesion is just a plain "n...

Oracle how to export query to a text/csv file

Hi, I was wondering how to go about exporting a query from PL/SQL to an text file or csv file. The query I have in mind exports a huge amount of data (about 1 gig). So I'd also like the data split across multiple files; out1.csv out2.csv out3.csv I'd like to be able to decide how many files to split it across. Anyone have any idea ho...

Is python automagically parallelizing IO- and CPU- or memory-bound sections?

This is a follow-up questions on a previous one. Consider this code, which is less toyish than the one in the previous question (but still much simpler than my real one) import sys data=[] for line in open(sys.argv[1]): data.append(line[-1]) print data[-1] Now, I was expecting a longer run time (my benchmark file is 65150224 li...