file

Intersection of files

≯℡__Kan透↙ 提交于 2021-02-13 03:43:16
问题 I two large files (27k lines and 450k lines). They look sort of like: File1: 1 2 A 5 3 2 B 7 6 3 C 8 ... File2: 4 2 C 5 7 2 B 7 6 8 B 8 7 7 F 9 ... I want the lines from both files in which the 3rd column is in both files (note lines with A and F were excluded): OUTPUT: 3 2 B 7 6 3 C 8 4 2 C 5 7 2 B 7 6 8 B 8 whats the best way? 回答1: awk '{print $3}' file1 | sort | uniq > file1col3 awk '{print $3}' file2 | sort | uniq > file2col3 grep -Fx -f file1col3 file2col3 | awk '{print "\\w+ \\w+ " $1 "

DataTables Excel style based on cell class

北城余情 提交于 2021-02-11 17:49:32
问题 I'm using DataTables plugin to export a monthly calendar view; I need to set a cell style inside the excel file based on the class of the corrisponding cell in the DataTables calendar view. I know how to style the exported excel file using the customize: function( xlsx, index ) {} however I'm not able to find, in the examples I saw on the forum, a way to set the style of the excel cell based on the class of the corrispondig cell in the DataTables view. I have created my own xml style like

Writing an array to a file in C

丶灬走出姿态 提交于 2021-02-11 17:25:30
问题 I am attempting to write an array of the first N primes to a txt file in rows of 5 entries each, with 10 spaces between each entry. The relevant code is as follows: #include<stdio.h> #include<math.h> #define N 1000 ... void writePrimesToFile(int p[N], char filename[80]) { int i; FILE *fp = fopen(filename, "w"); for(i = 0; i<=N-1; i++) { for(i = 0; i<5; i++) { fprintf(filename, "%10%i", p[i]); } printf("/n"); fclose(fp); } printf("Writing array of primes to file.\n"); } The compiler throws the

Searching entire computer for specified file

女生的网名这么多〃 提交于 2021-02-11 17:22:28
问题 Is there a way to search the entire computer and get the full file path of specified file, given a filename to match against? If you enter for example "file.dat" in textbox it show you full file path if it exist? 回答1: Look into the Directory class in System.IO . Whichever solution you use, avoid using GetFiles() instead use EnumerateFiles() since EnumerateFiles() is recommended for large arrays. (In your case the entire C drive) As per the MSDN documentation: Enumerable collections provide

Moving files to another directory

老子叫甜甜 提交于 2021-02-11 17:19:45
问题 I am trying to move several thousand documents from a list in one column and then move them to the folders listed in the other column, and then finally a third column with what has been moved and what hasn't (there will be errors where the file doesn't exist. I know how to do it on a file by file basis as below: How do I do it for the whole columns though? Sub Copy_One_File() FileCopy "C:\Users\Ron\SourceFolder\Test.xls", "C:\Users\Ron\DestFolder\Test.xls" End Sub Sub Move_Rename_One_File()

Getting error about ImageMagick With Python/MoviePy when I try add text clip

Deadly 提交于 2021-02-11 16:51:38
问题 I am using python 3.8.5 as well as the latest version of imagemagick and moviepy error (vs code): Traceback (most recent call last): File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\site-packages\moviepy\video\VideoClip.py", line 1137, in __init__ subprocess_call(cmd, logger=None) File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\site-packages\moviepy\tools.py", line 46, in subprocess_call proc = sp.Popen(cmd, **popen_params) File "C:\Users\edgib102

Getting error about ImageMagick With Python/MoviePy when I try add text clip

混江龙づ霸主 提交于 2021-02-11 16:51:34
问题 I am using python 3.8.5 as well as the latest version of imagemagick and moviepy error (vs code): Traceback (most recent call last): File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\site-packages\moviepy\video\VideoClip.py", line 1137, in __init__ subprocess_call(cmd, logger=None) File "C:\Users\edgib102\AppData\Local\Programs\Python\Python38-32\lib\site-packages\moviepy\tools.py", line 46, in subprocess_call proc = sp.Popen(cmd, **popen_params) File "C:\Users\edgib102

Python / PySerial / Arduino Reading serial data and later writing this exact serial data to the txt file

无人久伴 提交于 2021-02-11 16:21:20
问题 I am making a new post regarding this case because I was misunderstood in the first one... I have a code that reads the serial data from the Arduino and when some specific digits are pressed on the keyboard it writes these digits to the Arduino. This exact code works perfectly when I run it , it reads the serial data and I am able to write data to the Arduino. I use threading and PySerial library to achieve this. from pynput import keyboard import threading import serial import sys ser = None

Python / PySerial / Arduino Reading serial data and later writing this exact serial data to the txt file

老子叫甜甜 提交于 2021-02-11 16:19:52
问题 I am making a new post regarding this case because I was misunderstood in the first one... I have a code that reads the serial data from the Arduino and when some specific digits are pressed on the keyboard it writes these digits to the Arduino. This exact code works perfectly when I run it , it reads the serial data and I am able to write data to the Arduino. I use threading and PySerial library to achieve this. from pynput import keyboard import threading import serial import sys ser = None

How to read alphanumeric values from Excel cells in Java?

[亡魂溺海] 提交于 2021-02-11 16:01:02
问题 I have to read a ZIP code from Excel sheet. Zip code can be any of the following formats: ααααα 11111-αααα 3 3 3 3 3 - 6 6 6 6 12345 123456 12345-123456 I tried cell.getRichStringCellValue() and cell.getStringCellValue() but it's not working. 回答1: Above is the Image of the excel. I have used poi to get the data, looks like you have used poi but not 100% sure. Below is the code that is working and reading all the values public static void main(String[] args) throws IOException {