text-files

Can't Separate Text File By Delimiter |

怎甘沉沦 提交于 2019-12-07 17:11:02
问题 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.ini file but it isn't working. Here is my schema file. [MyTextFile.CSV] Format=Delimited(|) ColNameHeader=False Col1=fullstockn Text col2=FULLINFO Text MaxScanRows=0

How do I get rid of this unicode character?

↘锁芯ラ 提交于 2019-12-07 17:09:14
问题 Any idea how to get rid of this irritating character U+0092 from a bunch of text files? I've tried all the below but it doesn't work. It's called U+0092 + control from the character map sed -i 's/\xc2\x92//' * sed -i 's/\u0092//' * sed -i 's///' * Ah, I've found a way: CHARS=$(python2 -c 'print u"\u0092".encode("utf8")') sed 's/['"$CHARS"']//g' But is there a direct sed method for this? 回答1: Try sed "s/\`//g" * . (I added the g so it will remove all the backticks it finds). EDIT : It's not a

batch file write <> to text file

南笙酒味 提交于 2019-12-07 16:08:29
问题 This is my first time doing these things. Basically I am creating a batch file html maker for church songs. This is what I am stuck with: echo <br> %var17% >>Runfiles\temporary2.txt Basically var 17 is a line of lyric and I want to add a line break in front of it. I have seperated the template maker into three parts: first half lyrics second half Here is the code: @echo off copy "I:\Build\Files\*.txt" ren *.txt temp.txt setlocal ENABLEDELAYEDEXPANSION set vidx=0 for /F "tokens=*" %%A in (temp

Efficient way to add two lines at the beginning of a very large file

送分小仙女□ 提交于 2019-12-07 10:52:34
问题 I have a group of very large (a couple of GB's each) text files. I need to add two lines at the beginning of each of these files. I tried using sed with the following command sed -i '1iFirstLine' sed -i '2iSecondLine' The problem with sed is that it loops through the entire file, even if had to add only two lines at the beginning and therefore it takes lot of time. Is there an alternate way to do this more efficiently, without reading the entire file? 回答1: You should try echo "1iFirstLine" >

How to know the directory of jar file in java? [duplicate]

岁酱吖の 提交于 2019-12-07 07:58:36
This question already has an answer here : Getting filesystem path of class being executed [duplicate] (1 answer) Closed 4 years ago . I have an executable jar file and I want it to be able to read and write info to a txt file that is located at the same dir as the .jar file is. How can I do that? How can I get the executable jar file dir path. It only has to work on windows platform and it's a desktop application. You don't need to specify full path in order to create new files, java will create new files in current working directory by default. I have an executable jar file and I want it to

Using OleDbConnection to Read Tab-Separated File

瘦欲@ 提交于 2019-12-07 06:55:01
问题 My tab-delimited file is something like this: ISO ISO3 ISO-Numeric AD AND 20 I've been trying the following code with no luck. OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= |DataDirectory|;Extended Properties='text;HDR=Yes;FMT=TabDelimited'"); OleDbCommand cmd = new OleDbCommand(@"SELECT * FROM countryInfo.txt", cn); OleDbDataAdapter da = new OleDbDataAdapter(cmd); cn.Open(); DataTable dt = new DataTable(); da.Fill(dt); Here's a screenshot of the

Java: Sorting text file lines

老子叫甜甜 提交于 2019-12-07 05:49:42
问题 I'm using eclipse and I'm trying to sort a text file with about 40 lines that look like this: 1,Terminator,1984,Schwarzenegger 2,Avatar,2009,Worthington 3,Avengers,2012,Downey 4,Starwars,1977,Hammill 5,Alien,1979,Weaver I want sort them alphabetically by the second field so that the text file is altered to look like this: 5,Alien,1979,Weaver 2,Avatar,2009,Worthington 3,Avengers,2012,Downey 4,Starwars,1977,Hammill 1,Terminator,1984,Schwarzenegger I'm fairly certain I should be doing something

Best way for read and write a text file

孤街醉人 提交于 2019-12-07 05:43:50
问题 I am using the latest version of Lazarus IDE and I have a Memo1 on my TForm1. I have to load a text file in Memo1 and then edit every line of the Memo (I use Memo1.Lines.Strings[i] := ... ). At the end I must save the edited memo at a particular path. Question : I am looking for the faster way between: Load the whole text inside the memo, edit its content and save into a new file (load all -> edit all -> write all) Do a while loop (until the end of my *.txt file) that reads the file line by

Is it possible to show the contents of a text file in Crystal Reports

蹲街弑〆低调 提交于 2019-12-07 05:43:41
问题 I have a crystal report which contains a list of absolutely referenced text files. There is one text file referenced in each body line. e.g. line1 c:\file1.txt line2 c:\file2.txt Is there any way to display the contents of these files in Crystal? i.e. I would like each crystal body line to show the text from the referenced text file. I'm using Crystal reports 11 with a non-standard database connector (dataflex). 回答1: You would need to set up a file dsn (in XP it's under Control Panel

How to Log Console Screen into a Text File? [duplicate]

冷暖自知 提交于 2019-12-07 05:23:59
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: Mirroring console output to a file I've a console application in C# and I want to Log into a text file every text appears on the screen. How to do that ? Unfortunately this thread is closed despite of my comment about the Mirroring console output to a file. The accepted post as answer by that thread IS NOT CORRECT. So why cannot ask the question again? I'm using console interactively and want a copy of all the