extract

How can I untar a tar.bz file in unix?

冷暖自知 提交于 2019-12-20 10:20:04
问题 I've found tons of pages saying how to untar tar.bz2 files, but how would one untar a tar.bz file? 回答1: use the -j option of tar . tar -xjf /path/to/archive.tar.bz 回答2: According to the man pages for bzip2 If the file does not end in one of the recognised endings, .bz2, .bz, .tbz2 or .tbz, bzip2 complains that it cannot guess the name of the original file, and uses the original name with .out appended. Based on this, I'm guessing that '.bz' is considered a valid suffix for bzip2 compressed

BASH: How to extract substring that is surrounded by specific text

て烟熏妆下的殇ゞ 提交于 2019-12-20 06:12:43
问题 I am trying to extract numbers from file names that follow a specific pattern: file-8923489_something.txt another_file-8923489_something.txt some-other_file-8923489_something.txt I want to extract the number that is between text "file-" and "_something" that will work with the above 3 file names. What is the best way to go about this? Is it possible to do this using operators only, such as ## and %%? How about something like: filename=file-8923489_something.txt file=${${filename##*file}%%

XML Data extraction

限于喜欢 提交于 2019-12-20 06:03:15
问题 <Filer> <ID>123456789</ID> <Name> <BusinessNameLine1>Stackoverflow</BusinessNameLine1> </Name> <NameControl>stack</NameControl> <USAddress> <AddressLine1>123 CHERRY HILL LANE</AddressLine1> <City>LA</City> <State>CA</State> <ZIPCode>90210</ZIPCode> </USAddress> </Filer> Here I have a sample of xml code given to me. With this xml I need to grasp a certain attribute from this xml. I simply need to extract all the <BusinessNameLine1> from the file. The issue is that this tag appears multiple

XML Data extraction

孤者浪人 提交于 2019-12-20 06:02:37
问题 <Filer> <ID>123456789</ID> <Name> <BusinessNameLine1>Stackoverflow</BusinessNameLine1> </Name> <NameControl>stack</NameControl> <USAddress> <AddressLine1>123 CHERRY HILL LANE</AddressLine1> <City>LA</City> <State>CA</State> <ZIPCode>90210</ZIPCode> </USAddress> </Filer> Here I have a sample of xml code given to me. With this xml I need to grasp a certain attribute from this xml. I simply need to extract all the <BusinessNameLine1> from the file. The issue is that this tag appears multiple

Is there a Ruby equivalent to PHP's extract?

梦想的初衷 提交于 2019-12-19 17:40:44
问题 I can create a block that will extract hash elements and turn them into local variables, but I'm wondering if a native method already exists. Something like this: extract({ :foo => 'bar', :foo2 => 'bar2' }) puts foo # 'bar' puts foo2 # 'bar2' Note that the keys are private, and that the scope needs to stay local. 回答1: You can get close: bar, bar2 = h.values_at :foo, :foo2 Or I suppose we could extend Hash to extract into instance variables: class Hash def extract o each { |k, v| o.instance

Extract .xip files into a specific folder

泪湿孤枕 提交于 2019-12-19 05:45:07
问题 A XIP file is an analog to zip, but allows for a digital signature to be applied and verified on the receiving system, before the archive is expanded. When a XIP file is opened (by double-clicking), Archive Utility will automatically expand it (but only if the digital signature is intact). Essentially, a .xip file is just a .zip with a signature to verify that the file has not changed since its creator saved it. This protects from both damage from a disk error and from a third-party tampering

Rename extracted file based on zip file in Batch

淺唱寂寞╮ 提交于 2019-12-19 03:31:34
问题 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

R, tm-error of transformation drops documents

陌路散爱 提交于 2019-12-18 23:02:29
问题 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

R, tm-error of transformation drops documents

痞子三分冷 提交于 2019-12-18 23:01:27
问题 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

.NET How to extract embedded image from email message?

99封情书 提交于 2019-12-18 18:29:28
问题 Hello I'm working on a project in .NET 1.1 and I have a requirement to extract (and save it somewhere) embedded image from emails that I'm receiving. Can someone give me a clue on where to start? thank you 回答1: The email downloaded from the POP server will be in text format, you will have to parse the whole email, and find all the <img /> tags having the src attribute set to cid:* E.g. <img src='cid:006901c6d391$dee64770$6c822ecf@Z2LC74Q' /> The format of an email containing the embedded