text-files

Tools to search for strings inside files without indexing [closed]

戏子无情 提交于 2019-12-05 00:28:37
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I have to change some connection strings in an incredibly old legacy application, and the programmers who made it thought it would be a great idea to plaster the entire app with connection strings all over the place. Visual Studio's "current project" search is incredible slow, and I don't trust Windows Search. So, what's the best free, non-indexed text search tool out there? All it should do is return a list

Delete line from text file with line numbers from another file

痞子三分冷 提交于 2019-12-04 23:56:44
问题 I have a text file containing a giant list of line numbers which I have to remove from another main file. Here's what my data looks like lines.txt 1 2 4 5 22 36 400 ... and documents.txt string1 string2 string3 ... If I had a short list of line numbers I could've easily used sed -i '1d,4d,5d' documents.txt . But there are lots of lots of line number that I have to delete. Also, I could use bash/perl script to store the line numbers in an array and echo the lines which are not in the array.

Is there an upper limit on .txt file size?

走远了吗. 提交于 2019-12-04 22:38:27
As a Christmas gift I have written a small program in Java to calculate primes. My intention was to leave it on all night, calculating the next prime and writing it to a .txt file. In the morning I would kill the program and take the .txt file to my friend for Christmas. Is there anything I should be worried about? Bear in mind that this is true beginner Ziggy you are talking to, not some smart error checking ASM guy. EDIT More specifically, since I will be leaving this program on all night counting primes, is there any chance at all that I will encounter some kind of memory related error?

Is there a better way to process a 300,000 line text file data and insert it into MySQL?

折月煮酒 提交于 2019-12-04 21:18:12
What I'm doing right now is reading the contents of the text file and store it in a variable. After reading the whole content, I run a loop for the chunk data and in there call a function that will read to each line of the chunk data and pass every line to another function that process the processing of each column of data and inserting it in the database by batch. The batch is the whole chunk. The code process too long for every file with more than 500KB size. My problem is there is no unique identifier in the text file that I can use so that I can apply "LOAD DATA INFILE" which put me in

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

青春壹個敷衍的年華 提交于 2019-12-04 20:20:56
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); fclose(fid); I then process the file and change a few values of the column. Now I want to write a new file newfile.txt in the exact same format as my file.txt with the new values. How do I do that? If I do the following: M = [datenum(a{1}) a{2}]; dlmwrite('newfile1.txt', M); it

how do you save from a savefile dialog in C#?

别来无恙 提交于 2019-12-04 19:35:21
here is the code I am currently using to open a file using the openfiledialog ` private void openToolStripMenuItem_Click_1(object sender, System.EventArgs e) { //opens the openfiledialog and gives the title. openFileDialog1.Title = "openfile"; //only opens files from the computer that are text or richtext. openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; //gets input from the openfiledialog. if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //loads the file and puts the content in the richtextbox. System.IO.StreamReader sr = new System.IO

How to print an array to a .txt file in Matlab?

我是研究僧i 提交于 2019-12-04 18:25:47
问题 I am just beginning to learn Matlab , so this question might be very basic: I have a variable a=[2.3 3.422 -6.121 9 4.55] I want the values to be output to a .txt file like this: 2.3 3.422 -6.121 9 4.55 How can I do this? fid = fopen('c:\\coeffs.txt','w'); //this opens the file //now how to print 'a' to the file?? 回答1: The following should do the trick: fid = fopen('c:\\coeffs.txt','wt'); % Note the 'wt' for writing in text mode fprintf(fid,'%f\n',a); % The format string is applied to each

How to import data with line breaks from text file into R?

懵懂的女人 提交于 2019-12-04 17:24:10
I have a text file that I'd like to import into R . Problem is, the file looks like this: x1,x2,x3,x4,x5,x6,x7,x8,x9,10,x11 1953.00 7.40000 159565. 16.6680 8883.00 47.2000 26.7000 16.8000 37.7000 29.7000 19.4000 1954.00 7.80000 162391. 17.0290 8685.00 46.5000 22.7000 18.0000 36.8000 29.7000 20.0000 and so on. I tried > data <- read.table("clipboard", header=TRUE) but that didn't work. While the data is ill-formed it still can be parsed given the following assumptions: The header defines how many variables there are (columns in the resultant table) The data itself is complete - e.g. there are

Alternatives for enhanced reading and parsing text files using .NET

坚强是说给别人听的谎言 提交于 2019-12-04 13:58:12
I need to read from a variety of different text files (I've some delimited files and some fixed width files). I've considered parsing the files line by line (slow using the File.ReadLine type methods) and reading the file using the ODBC text driver (faster) but does anyone have any other (better) suggestions? I'm using .NET/C#. I'm not sure you could really do a text-and-Excel file parser, not unless by Excel file you mean a comma/pipe/tab delimited file, which is actually just another text file. Reading actual excel files require you to use the MS Office libraries. For delimited text file

Creating a new .txt file with date in front, C#

ぐ巨炮叔叔 提交于 2019-12-04 13:14:24
I am trying to get the following: [today's date]___[textfilename].txt from the following code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication29 { class Program { static void Main(string[] args) { WriteToFile(); } static void WriteToFile() { StreamWriter sw; sw = File.CreateText("c:\\testtext.txt"); sw.WriteLine("this is just a test"); sw.Close(); Console.WriteLine("File created successfully"); } } } I tried putting in DateTime.Now.ToString() but i cannot combine the strings. Can anybody help me? I want the