text-files

How to import data from text file to mysql database

匆匆过客 提交于 2019-11-26 23:50:00
I have a 350MB file named text_file.txt containing this tab delimited data: 345868230 1646198120 1531283146 Keyword_1531283146 1.55 252910000 745345566 1646198120 1539847239 another_1531276364 2.75 987831000 ... MySQL Database name: Xml_Date Database table: PerformanceReport I have already created the table with all the destination fields. I want to import this text file data into a MySQL. I googled and found some commands like LOAD DATA INFILE and quite confused on how to use it. How can I import this text file data? It should be as simple as... LOAD DATA INFILE '/tmp/mydata.txt' INTO TABLE

Convert Word doc or docx files into text files?

可紊 提交于 2019-11-26 22:45:18
问题 I need a way to convert .doc or .docx extensions to .txt without installing anything. I also don't want to have to manually open Word to do this obviously. As long as it's running on auto. I was thinking that either Perl or VBA could do the trick, but I can't find anything online for either. Any suggestions? 回答1: Note that an excellent source of information for Microsoft Office applications is the Object Browser . You can access it via Tools → Macro → Visual Basic Editor . Once you are in the

Copying from one text file to another using Python

有些话、适合烂在心里 提交于 2019-11-26 22:43:51
问题 I would like to copy certain lines of text from one text file to another. In my current script when I search for a string it copies everything afterwards, how can I copy just a certain part of the text? E.g. only copy lines when it has "tests/file/myword" in it? current code: #!/usr/bin/env python f = open('list1.txt') f1 = open('output.txt', 'a') doIHaveToCopyTheLine=False for line in f.readlines(): if 'tests/file/myword' in line: doIHaveToCopyTheLine=True if doIHaveToCopyTheLine: f1.write

Text file in VBA: Open/Find Replace/SaveAs/Close File

那年仲夏 提交于 2019-11-26 22:42:29
Here is pseudocode for what I am hoping to do: Open text File Find "XXXXX" and Replace with "YYYY" Save text File As Close text file This is what I have so far Private Sub CommandButton1_Click() Dim sBuf As String Dim sTemp As String Dim iFileNum As Integer Dim sFileName As String ' Edit as needed sFileName = "C:\filelocation" iFileNum = FreeFile Open sFileName For Input As iFileNum Do Until EOF(iFileNum) Line Input #iFileNum, sBuf sTemp = sTemp & sBuf & vbCrLf Loop Close iFileNum sTemp = Replace(sTemp, "DIM A", "1.75") sTemp = Replace(sTemp, "DIM B", "2.00") sTemp = Replace(sTemp, "DIM C", "3

Matlab read in txt file into array

跟風遠走 提交于 2019-11-26 22:25:40
问题 I have a text file with the following format of information: Name1 34 25 36 46 Name1 23 53 15 86 Name1 25 25 87 35 Name2 76 22 44 55 Name2 88 88 88 88 Name3 11 11 11 11 Name3 55 66 88 88 Name3 88 88 88 88 Name3 00 00 00 00 There are different "Names" and I have to arrange each name into an array slot. I would then need another way to allocate the date associated with each row to that specific spot. So for example, the first Name1 may have array{0}, but I would also need to associate the 34,

How do I correct the character encoding of a file?

别说谁变了你拦得住时间么 提交于 2019-11-26 22:20:27
I have an ANSI encoded text file that should not have been encoded as ANSI as there were accented characters that ANSI does not support. I would rather work with UTF-8. Can the data be decoded correctly or is it lost in transcoding? What tools could I use? Here is a sample of what I have: ç é I can tell from context (café should be café) that these should be these two characters: ç é EDIT: A simple possibility to eliminate before getting into more complicated solutions: have you tried setting the character set to utf8 in the text editor in which you're reading the file? This could just be a

Batch / Find And Edit Lines in TXT file

自闭症网瘾萝莉.ら 提交于 2019-11-26 22:11:26
I want to create a batch while which finds specific lines in a batch file and are able to edit these lines. Example: //TXT FILE// ex1 ex2 ex3 ex4 i want to let the batch file find 'ex3' and edit this to 'ex5' to let it look like this: ex1 ex2 ex5 ex4 ghostdog74 On a native Windows install, you can either use batch(cmd.exe) or vbscript without the need to get external tools. Here's an example in vbscript: Set objFS = CreateObject("Scripting.FileSystemObject") strFile = "c:\test\file.txt" Set objFile = objFS.OpenTextFile(strFile) Do Until objFile.AtEndOfStream strLine = objFile.ReadLine If InStr

Editing a text file in place through C#

本秂侑毒 提交于 2019-11-26 22:00:40
问题 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 text which has to be replaced is exactly the same size as the source text (if this helps). 回答1: Since the file is so large you may want to take a look at the

Putting a .txt file into a DataGridView

流过昼夜 提交于 2019-11-26 21:52:00
问题 I have an openFileButton that, when clicked, will open a file that looks like this: RefDeg Part# Xcntr Ycntr Rot PkgStyle U6 IC-00279G 33.411 191.494 0 QFP32 U1 IC-00272G 38.011 200.644 90 BGA177 U5 IC-00273G 46.311 179.494 0 QFP40 R54 EXCLUDES 36.411 173.694 0 0402_2 R71 EXCLUDES 38.236 186.994 0 0402_2 R39 EXCLUDES 38.861 188.544 90 0402_2 C23 CAP-00130G 37.911 178.854 90 0402_3 C88 CAP-00010G 52.036 179.019 0 0603_4 C89 CAP-00010G 43.561 173.744 90 0603_3 X1 XTL-00013G 49.211 204.819 0

Notepad++ can recognize encoding?

不问归期 提交于 2019-11-26 21:33:32
问题 I created file with UTF-8 encoded content (using PHP fputcsv). When I open this file in Notepad++ - characters are wrong (Notepad++ starts with ANSI encoding). When I set Format->"Encode in UTF-8" from menu - everything is fine. Im worrying, that Notepad++ can recognize encoding somehow, and maybe something is wrong with my file created with fputcsv ? First byte or something? 回答1: Automatically detecting an encoding is not something that can be done accurately. It's pretty much essential that