text-files

Compare text files - Igonring some texts using VBscripting

若如初见. 提交于 2019-12-08 13:46:09
问题 First of all, I am not from programming background and totally new to VBscript. For some reasons, I have to do a this scripting task at office. I want to use it with Quick Test Professional 11. I have gone through many posts here as well on other forums but not able to find the required information. Ok so here's what I need to do: I have to compare two text files and write the difference in third file. Both the files have almost same content aprt from some field, ie: Date, Order no and so on.

Retrieving and Replacing number in text file

社会主义新天地 提交于 2019-12-08 13:02:54
问题 I need to retrieve and change a number in a text file that will be in the first line. It will change lengths such as "4", "120", "78" to represent the data entries held in the text file. 回答1: If you need to change the length of the first line then you are going to have to read the entire file and write it again. I'd recommend writing to a new file first and then renaming the file once you are sure it is written correctly to avoid data loss if the program crashes halfway through the operation.

How to use a batch file to delete a line of text in a bunch of text files?

℡╲_俬逩灬. 提交于 2019-12-08 12:02:31
问题 I have a bunch of txt files in my D drive which are placed randomly in different locations. Some files also contain symbols. I want a batch file so that I can delete their specific lines completely at the same time without doing it one by one for each file and please refer to a code which does not create a new text file at some other location with the changes being incorporated i.e. I do not want the input.txt and output.txt thing. I just need the original files to be replaced with the

extract matched line from text file

眉间皱痕 提交于 2019-12-08 11:52:38
问题 a:b:c:d:e bb:cc:dd:ee:ff ccc:ddd:eee:fff:ggg I have a textfile content above. I am trying to compare my user input with the text file. For example cc:dd When it is found, I need to retrieve the entire line. How can I retrieve the line which my user input? I have tried using while(scanner.hasNext()) but I could not get my desire outcome. 回答1: With standard Java libraries: File file = new File("file.txt"); String word = "abc"; Scanner scanner = null; try { scanner = new Scanner(file); } catch

Send txt file to printer with Excel VBA

早过忘川 提交于 2019-12-08 09:54:52
问题 I have a sub that creates a .txt file and I want to print it in the default printer. How can I achieve this in VBA? I think I need to call the ShellExecute API Function, but I did not find the correct sintax for that. I would appreciate any help! 回答1: I cannot comment yet, so most will ask you to show the code that you tried and then you get help here. I did a quick google search and found many examples. Search this and I found some code snippets excel vba print file 回答2: I found a code that

Writing to the middle of a text file in Java

让人想犯罪 __ 提交于 2019-12-08 08:50:04
问题 What's the best way to write to the middle of a text file in Java? I know that there's no getting around reading the entire file to memory and then writing it back. But parsing is really one of my weak skills and the multitude of classes related to file I/O is confusing (choosing between File, FileWriter, FileOutputStream, BufferedWriter... AHHHHH!!) Let's say I have a text file like this: The quick brown fox jumped over the lazy dog. The lazy dog laughed at the silly jumping fox. The dog's

VBA: save cell contents to text file in a specific location on Mac

吃可爱长大的小学妹 提交于 2019-12-08 08:34:59
问题 I'm really new to VBA, and I'm trying write a macro that will save the contents of some specifc cells to a specific location on my Mac. The whole code works fine, EXCEPT that it won't save to the right location; all files save to the desktop. Basically, A1 starts out containing something like this "260 - CategoryA - 555.555.555.555 - 2012-11-06 17:43:49," and I want the macro to save the contents of column A, rows 2-61 to a text file named after the first 3 numbers in cell A1. The location I

I would like some advice why this would not insert data into my SQL table

◇◆丶佛笑我妖孽 提交于 2019-12-08 07:33:54
问题 Following is my code: import MySQLdb def insert_popularity(PersonNumber, Category, Value): # make a connection to the dataabse connection = MySQLdb.connect(host='localhost', user='root', \ passwd='password', db='inb104') # get a cursor on the database cursor = connection.cursor() # construct the SQL statement sql = ("""INSERT INTO popularity (PersonNumber, Category, Value) VALUES(%s, %s, %s)""", (number, category, data)) def open_file(filename): txt_file = file(filename, 'r') for line in txt

How to STDIN and STDOUT with PHP and Python to use html2text and get a markdown formated text?

蹲街弑〆低调 提交于 2019-12-08 07:12:59
问题 I am sending an HTML text from PHP to Python via STDIN. My objctive is to use Aaron Swartz's script "html2text.py" and to print the result to PHP via STDOUT. Camarade Jan gave me the word and put me in the right direction. Here's my test: PHP code: $t='<p><b>Hello</b><i>world!</i></p>'; $scaped=preg_quote($t,"/")."\n";//\<p\>\<b\>Hello\<\/b\>\<i\>world\!\<\/i\>\<\/p\> exec('python hi.py '.$scaped,$r); print_r($r);//result Python code: #! /usr/bin/env python import html2text import sys #print

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

旧时模样 提交于 2019-12-08 06:26:13
问题 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. 回答1: You don't need to specify full path in order to create new files, java