textfiles

Searching Through a TextFile - Cocoa

How would I type up a code that searches through a text file from a given directory. I want the search word to be "password123" and if it contains that, then it will proceed onto the next step, if not it will give an error message. ...

Are there any tricks for counting the number of lines in a text file?

Say you have a text file - what's the fastest and/or most memory efficient way to determine the number of lines of text in that file? Is it simply a matter of scanning through it character by character and looking for newline characters? ...

Shuffle Text File Delphi Source or anything else

Hi I have a stringlist with 10 000 entires. I have a shuffle routine, but accessing any of the items is taking a lot of time. Going thtought all 10k items takes a huge amount of time. I want to save it do disk and then do a shuffle on the file using another method. Any suggestions? Any source code welcome, Delphi preferable. Thanks ...

How to append text to an existing file in Java

I need to append text repeatedly to an existing file in Java. How do I do that? ...

Processing huge text files

Problem: I've a huge raw text file (assume of 3gig), I need to go through each word in the file and find out that a word appears how many times in the file. My Proposed Solution: Split the huge file into multiple files and each splitted file will have words in a sorted manner. For example, all the words starting with "a" will be stored ...

MATLAB: How do you insert a line of text at the beginning of a file?

I have a file full of ascii data. How would I append a string to the first line of the file? I cannot find that sort of functionality using fopen (it seems to only append at the end and nothing else.) ...

Preserving leading white space while reading>>writing a file line by line in bash

I am trying to loop through a directory of text files and combine them into one document. This works great, but the text files contain code snippets, and all of my formatting is getting collapsed to the left. All leading whitespace on a line is stripped. #!/bin/sh OUTPUT="../best_practices.textile" FILES="../best-practices/*.textile" fo...

PHP and regex to find files in directories and then run regex

hi, what's the the most efficient way to find text files in different directories and then run regex to those found files. I will run php/scripts locally. Let's say I have D:\Script\ where i want to run my script from and D:\Script\folder_01, D:\Script\folder_02, etc. where i want that script to look the files from. Those folder names a...

How to configure GNU Emacs to write UNIX or DOS formatted files by default?

I've had these functions in my .emacs.el file for years: (defun dos2unix () "Convert a DOS formatted text buffer to UNIX format" (interactive) (set-buffer-file-coding-system 'undecided-unix nil)) (defun unix2dos () "Convert a UNIX formatted text buffer to DOS format" (interactive) (set-buffer-file-coding-system 'undecided-d...

Selective merge of two or more data files

Dear Overflowns: I have an executable whose input is contained in an ASCII file with format: $ GENERAL INPUTS $ PARAM1 = 123.456 PARAM2=456,789,101112 PARAM3(1)=123,456,789 PARAM4 = 1234,5678,91011E2 PARAM5(1,2)='STRING','STRING2' $ NEW INSTANCE NEW(1)=.TRUE. PAR1=123 [More data here] $ NEW INSTANCE NEW(2)=.TRUE. [etcetera] In ...

How to write trace output to a text file without a web server in AS3

I have an application that writes traces with a timestamp when certain items are clicked or accessed. I need to write these to a text log file so that they can be accessed remotely.. The device the app runs on doesn't have a web server and doesn't run the flash debug player, os is xp. How can I send these traces to a text file? I noticed...

Remove first line in text file without allocating memory for entire text file

Hey all, I have a very large text file and all I need to do is remove one single line from the top of the file. Ideally, it would be done in PHP, but any unix command would work fine. I'm thinking I can just stream through the beginning of the file till I reach \n, but I'm not sure how I do that. Thanks, Matt Mueller ...

C# resuable library to treat a text file like a database table?

I would like to store values in a text file as comma or tab seperated values (it doesn't matter). I am looking for a reusable library that can manipulate this data in this text file, as if it were a sql table. I need select * from... and delete from where ID = ...... (ID will be the first column in the text file). Is there some cod...

With PHP how do you output a textfile into a table along with links.

I have this text file: Dec 04 20:15 Naruto 123 Dec 04 17:42 Naruto 98 Dec 04 16:19 D Gray Man 001 Dec 04 16:05 Bleach 128 Dec 04 12:13 50 x 50 44 I need to output the contents into a table with the Date and Time in its own column and the Tile and Chapter in another. Also.. I need to replace the Title and Chapter with a link that must...

How do I write a text file in the same format that it is read in MATLAB?

I have asked a related question in the past and I know how to read the file thanks to the help of the experts here. Now I have a new problem. I first read the data from the file like so: fid = fopen('D:\file.txt', 'rt'); a = textscan(fid, '%s %f %f %f %f %f %f', ... 'Delimiter',',', 'CollectOutput',1, 'HeaderLines',1); fclo...

Problem with Extracting NSString from TXT

I am trying to create one long string from a text file. This is the code that I currently have. I do not really understand the encoding and I tried to research but found nothing. This is the line of code that I have: NSString* data = [[NSString alloc] initWithContentsOfFile:@"12thnew.txt" encoding: error:NULL]; When I entered the enco...

Most non-confrontational delimiter for my text files?

I am saving all my notes in a log file. Each line is a note, suffixed by tags, and prefixed by a date and time marker, which currently looks like this: [12.20.09:22.22] ([date:time]. I am planning to have this a long-living format. Notes will be logged willy-nilly with this format 20-30 times a day for years to come. I foresee numerou...

How do I use a Save Dialog Box in C# to save an ASCII text file?

Okay, I'm probably missing something really simple here, but I've been at this for over an hour now and getting nowhere. :( I have a C# project using Microsoft's Visual C# 2008 Express Edition. The Save dialog box appears as desired, but it never makes the file. Practially speaking, once the file is specified, I'd like the application...

Bind WPF TextBlock to text file

How can I bind a WPF TextBlock to a text file? I want for the TextBlock to display the content of the file. ...

fgetcsv - Add Quotes to fields that do not have quotes

Hello all, I have a text file (its comma delimited with some fields wrapped around in double quotes) when I parse through it using this: if (($handle = fopen('C:\tester\fake.txt', "r")) !== FALSE) { while (($data = fgetcsv($handle, ",")) !== FALSE) { $num = count($data); //echo "<p> $num fields in line $row: <br /><...