textfiles

Is there a way to recognize blank lines in Matlab?

Id there a way to recognize blank lines when you are scanning a textfile in Matlab? I want to parse the files based on the blank lines in between the text. Is this possible? ...

Editing a text file in place through C#

I have a huge text file, size > 4GB and I want to replace some text in it programmatically. I know the line number at which I have to replace the text but the problem is that I do not want to copy all the text (along with my replaced line) to a second file. I have to do this within the source file. Is there a way to do this in C#? The t...

Elegant way to count the number of lines that contain a string in a file

Hi, I have a quick question. As the title says, I'd like to find a way to count the number of lines that contain a specified string in a file, in PHP. I know I could simply open the file and loop through all the lines and see if anything matches, but that seems kind of cumbersome. Is there a better way? To further illustrate what I wa...

first thing i do in my php function is define an array why is undefined later in the function?

Hi. I have a long function with many if statements and such. The first thing i do in my function is this: $text = file($read_text_file); The $text array contain all text in the site therefor I need this array to be available in my entire function and I though I would accomplice this by defining the variable first thing in the function, ...

Sorting a text file & removing duplicates

Hi! I have a large text file with 4-digit codes and some information about them in every row. It looks something like this: 3456 information 1234 info 2222 Some ohter info I need to sort this file, so the codes are in ascending order in the file. Also, some codes appear more than once, so I need to remove duplicates. Can I do this wi...

Create files in PHP in some other folder

$ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); The file "testFile.txt" should be created in the same directory where this PHP code resides.Now is there any method to create this file in some other folder. I tried something like this - $ourFileName = "http://a...

Text file with ^M on each line

I just got a source code file from a friend. The file was created in UNIX. When I opened it in Windows using NotePad++, each line had one extra blank line. Puzzled, I downloaded Vim and used it to open the file. I then saw a bunch of ^M at the end of each line. What is this ^M? How do you prevent it from being inserted? ...

Create a summary text file of a folder with filename and the first two lines out of each file

I have a directory with 260+ text files containing scoring information. I want to create a summary text file of all of these files containing filename and the first two lines of each file. My idea was to create two lists separately and 'zip' them. However, I can get the list of the filenames but I can't get the first two lines of the fil...

Adobe Flex - TextArea to file

Hi All, I am having an text area in .mxml file. <mx:TextArea id="outputText" .../> I am exporting its data into a .txt on a button click. as - FileReference fRef=new FileReference; fRef.save(outputText.text,"testFile.txt"); But the problem is when I export it into a text file, it gets stored a single line instead of multiple lin...

How can I prepare the logs or textfiles to be read by MySQL using Load DATA INFILE INTO ?

What is the best way to prepare the log files before inserting their values in the MYSQL database using LOAD DATA INFILE '/tmp/someFile.txt' INTO TABLE How can I make sure and make the data log file ready to be read by such command ? Someone told me by scripting (using sed,grep,cat,sub ...) .. how can I do that or what are the to...

file extension query

I have a text file c1.data....Im trying to open it but it is not getting open up? what software do I need for it? ...

How to efficiently write a large text file in C#?

I am creating a method in C# which generates a text file for a Google Product Feed. The feed will contain upwards of 30,000 records and the text file currently weighs in at ~7Mb. Here's the code I am currently using (some lines removed for brevity's sake). public static void GenerateTextFile(string filePath) { var sb = new StringBui...

Read from an existing text file(.txt) in sql server 2005

My gps device writes its data to a text file in my server. Now i want sql server to read it and store values in a table. How to get started with this kind of a scenario? Any suggestion. EDIT: Consider it is an existing file with 10 rows and i have already imported it. Now the file gets updated with new 10 rows. How to import the new row...

bubbles within input fields - How?

I want to develop bubbles within input fields. Does anyone know a good tutorial or at least the actual name so I can look myself? I have provided examples below that illustrate what I mean, within the "to" field. Examples: Hotmail: http://thesocialmediaguide.com.au/wp-content/uploads/2010/03/email-to-Facebook.jpg ...

How to cat two files after each other but omit the last/first line respectively?

I have two files I want to cat together. However, the last line of the first file and the first line of the last file should be omitted. I am sure this can be done in a UNIX shell (or rather, Cygwin). But how? ...

c# streamreader textfiles read line before/after

Hi, in some some special cases i need some lines before and after the current position e.g. pubic string[] getLines(string value, int linesBefore, int linesAfter){ _streamReader = new StreamReader("file.tmp"); string[] returnValue; string line = _streamReader.ReadLine(); while (Line.instr() < 0) { Line = ...

Dumping a Text file into a VB.net program

I have a VB.net program that I have reading a text file, what is the best way to put the text file into VB to be able to check if a string is on one of the lines in a text file, sample code would be helpful. ...

Noob question about junit

I know this question is not a hard one. I want to implements jUnit on a small project I'm working on because I want to learn a little bit about it. The tutorials that I read all make reference to method that have a particular output. In my case my output are files, how can I do this? any simple example? any aproach that could help me ...

Matching data from text file with user input in Java

I need to retrieve the PIN from a notepad file (below) and check it with the PIN which the user has typed. I have tried this for days, but so far the solution that I have come up with gives me the correct output only when I type the full row (i.e. 1598 01-10-102203-0 95000). Also it displays the "Invalid PIN" for each and every reco...

How to input the name of the text file as a function's argument in Matlab?

Basically I export .dat files, with headers, from a software and then I use data in them in Matlab. I am making a general function in Matlab which could read the data from the .dat files I export from the software. Can you tell me the way I can input the name of the .dat file as function's argument? function [property_without_headers]=g...