extract

Rename extracted file based on zip file in Batch

时光毁灭记忆、已成空白 提交于 2019-11-30 22:34:52
I have multiple zip files with names such as 001.zip, 002.zip, 003.zip and have the potential to go up to 999.zip. Each zip file has exactly one text file. I would like to extract each zip file using Batch, and then rename the text file it extracted to the file name of the zip. For example, if I extract 001.zip, I want the text file that gets extracted (all the text files that get extracted have different names) to be name 001.txt. I at least am extracting all the files right now, but I am too unfamiliar with Batch, and am not sure if there is a simple way to do this? cd test echo

Extract time series of a point ( lon, lat) from netCDF in R

对着背影说爱祢 提交于 2019-11-30 22:29:50
I am relatively new on R. I am trying to get time series of different points ( lat, lon) of temperature data from a netCDF file. My sample data file is here and here is the small file . I have tried netCDF package and the code i have used so far library(ncdf) obsdata = open.ncdf("obs.nc") print.ncdf(obsdata) obsdatadates = obsdata$dim$time$vals obsdatadates = as.Date(obsdatadates,origin = '1950-01-01') obsdatadates obsoutput = get.var.ncdf(obsdata, varid = 'tasmin', start = c(1,1,1), count = c(1,1,22280)) dim(obsoutput) datafinal=merge(obsdatadates,obsoutput) Can anyone help me to get a

Extract string within parentheses - PYTHON

谁说我不能喝 提交于 2019-11-30 21:46:41
I have a string "Name(something)" and I am trying to extract the portion of the string within the parentheses! Iv'e tried the following solutions but don't seem to be getting the results I'm looking for. n.split('()') name, something = n.split('()') Maroun You can use a simple regex to catch everything between the parenthesis: >>> import re >>> s = 'Name(something)' >>> re.search('\(([^)]+)', s).group(1) 'something' The regex matches the first "(", then it matches everything that's not a ")": \( matches the character "(" literally the capturing group ([^)]+) greedily matches anything that's

VBA to get the href value

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 21:26:18
问题 I am writing macro to extract the href value from a website, example here is to extract the value: '/listedco/listconews/SEHK/2015/0429/LTN201504291355_C.pdf' from the html code below. The href is one of the attributes of the html tag 'a', I have add the code getElementbyTagName'a' but it did not work, my question is how to extract that href value to column L. Anyone could help? Thanks in advance! <a id="ctl00_gvMain_ctl03_hlTitle" class="news" href="/listedco/listconews/SEHK/2015/0429

How to extract audio from a video file using python?

大憨熊 提交于 2019-11-30 21:18:39
I want to write a python program that could extract audio from a video file (e.g. video.avi ). Is there any good library for it? And where should I start from? I tried to use PyMedia, but I couldn't install it on my MacOSX(Mountain Lion). EDIT: The problem is video.avi is not completely available. Someone is writing on it and adding some frames to it every second. So I wanted to write a code in python to get the video as it comes and extract the audio from it and write it to a file (e.g. audio.mp3 , audio.wav ). I don't know if ffmpeg can wait for the video to be copied to video.avi . And I

JSoup - Select all comments

梦想与她 提交于 2019-11-30 20:53:09
问题 I want to select all comments from a document using JSoup. I would like to do something like this: for(Element e : doc.select("comment")) { System.out.println(e); } I have tried this: for (Element e : doc.getAllElements()) { if (e instanceof Comment) { } } But the following error occurs in eclipse "Incompatible conditional operand types Element and Comment". Cheers, Pete 回答1: Since Comment extends Node you need to apply instanceof to the node objects, not the elements, like this: for(Element

stax - get xml node as string

萝らか妹 提交于 2019-11-30 20:52:02
xml looks like so: <statements> <statement account="123"> ...stuff... </statement> <statement account="456"> ...stuff... </statement> </statements> I'm using stax to process one " <statement> " at a time and I got that working. I need to get that entire statement node as a string so I can create "123.xml" and "456.xml" or maybe even load it into a database table indexed by account. using this approach: http://www.devx.com/Java/Article/30298/1954 I'm looking to do something like this: String statementXml = staxXmlReader.getNodeByName("statement"); //load statementXml into database Why not just

How to extract specific columns from a space separated file in Python?

ε祈祈猫儿з 提交于 2019-11-30 20:48:13
问题 I'm trying to process a file from the protein data bank which is separated by spaces (not \t). I have a .txt file and I want to extract specific rows and, from that rows, I want to extract only a few columns. I need to do it in Python. I tried first with command line and used awk command with no problem, but I have no idea of how to do the same in Python. Here is an extract of my file: [...] SEQRES 6 B 80 ALA LEU SER ILE LYS LYS ALA GLN THR PRO GLN GLN TRP SEQRES 7 B 80 LYS PRO HELIX 1 1 THR

REGEX in R: extracting words from a string

夙愿已清 提交于 2019-11-30 20:26:30
i guess this is a common problem, and i found quite a lot of webpages, including some from SO, but i failed to understand how to implement it. I am new to REGEX, and I'd like to use it in R to extract the first few words from a sentence. for example, if my sentence is z = "I love stack overflow it is such a cool site" id like to have my output as being (if i need the first four words) [1] "I love stack overflow" or (if i need the last four words) [1] "such a cool site" of course, the following works paste(strsplit(z," ")[[1]][1:4],collapse=" ") paste(strsplit(z," ")[[1]][7:10],collapse=" ")

R, tm-error of transformation drops documents

烈酒焚心 提交于 2019-11-30 20:20:50
I want to create a network based on the weight of keywords from text. Then I got an error when running the codes related to tm_map: library (tm) library(NLP) lirary (openNLP) text = c('.......') corp <- Corpus(VectorSource(text)) corp <- tm_map(corp, stripWhitespace) Warning message: In tm_map.SimpleCorpus(corp, stripWhitespace) : transformation drops documents corp <- tm_map(corp, tolower) Warning message: In tm_map.SimpleCorpus(corp, tolower) : transformation drops documents The codes were working 2 months ago, now I'm trying for a new data and it is not working anymore. Anyone please shows