FAQ Database Discussion Community


Extract meta description field with goquery

go,extract,meta
I'm using the goquery package to extract pieces of information from a webpage. Please see my code below. The outcome when after running the function is: Description field: text/html; charset=iso-8859-15 Description field: width=device-width Description field: THIS IS THE TEXT I WANT TO EXTRACT I'm almost there, however I only want...

How to extract data in tabular format from XML field in Oracle database?

sql,xml,oracle,extract
I'm trying to extract data in tabular format from an XML field in an Oracle database. Please see sample xml field below: <?xml version='1.0' encoding='UTF-8'?> <root> <element1> <Header Client_ID="100" Sent_date_time="2015-03-02T9:30:43.808-06:00"/> <element2> <element3 UnitPrice="3.2" ItemID="njh1"/> <element3 UnitPrice="4.1" ItemID="ole5"/> <element3 UnitPrice="4.6" ItemID="usd3"/> <element3 UnitPrice="8.2" ItemID="eor9"/> <element3 UnitPrice="2.9" ItemID="abc8"/> <element3...

Extracting data using regexp_extract in Google BigQuery

sql,regex,extract,google-bigquery
I am trying to extract data from a column which has multiple characters and I am only interested in getting the specific string from the input string. My sample input and outputs are as below. How can I implement this using regexp_extract function.Can someone share their thoughts on this if...

How to extract data at a specific location from a file containing a grid of data points

awk,extract
I have a file containing a 3D grid (x, y, time), with a property "v" at each grid point. I want to extract the time profile of "v" at a particular x, y point, or more specifically, at the x, y point closest to my desired location (it is unlikely...

How to extract coordinates in P-match result?

python,extract,bioinformatics,extraction
From this link http://www.gene-regulation.com/cgi-bin/pub/programs/pmatch/bin/p-match.cgi produced result that I need to process in order to obtain only sequence ID, start and end position. What are the ways I can extract coordinate information from the result? Below is example result. Scanning sequence ID: BEST1_HUMAN 150 (-) 1.000 0.997 GGAAAggccc R05891 354 (+)...

Extract the data from the sublist into dataframe

r,list,extract,dataframes,sublist
the structure of the list as follow (the list goes on with the same structure): > str(parsedData) > List of 1658 > $ :List of 2 > ..$ Date : chr "2010-08-16" > ..$ Volatility: num 11.1 > $ :List of 2 > ..$ Date : chr "2010-08-17" > ..$...

Extracting Substring from File Name

string,awk,substring,extract,cut
I have a list of files with the following file name format: [some unknown amount of characters][_d][yyyymmdd][some unknown amount of characters] I want to extract the substring that contains the date (yyyymmdd) which I know will always be proceeded by "_d". So basically I want to extract the first 8...

Search for specific strings of data from a binary .dat file, only extract text

string,vba,binary,extract
Sub ReadEntireFileAndPlaceOnWorksheet() Dim X As Long, Ys As Long, FileNum As Long, TotalFile As String, FileName As String, Result() As String, Lines() As String, rng As Range, i As Long, used As Range, lc As Long FileName = "C:\Users\MEA\Documents\ELCM2\DUMMY_FILE.dat" FileNum = FreeFile Open FileName For Binary As #FileNum TotalFile...

C++ - Getting string of text inbetween character and text

c++,string,console,extract
I'm making a console program that will get a line of text that starts with a specific character. I'm working with an .txt file as the input of text, and this is it: <?xml version="1.0" encoding="utf-8"?> <vector android:height="64.0dip" android:width="64.0dip" android:viewportWidth="24.0" android:viewportHeight="24.0" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="#00000000" android:pathData="M12.05,7.7c-1.1,0,-2,0.94,-2,2.05v0.5h4v-0.5C14.05,8.65,13.15,7.7,12.05,7.7z" /> <path...

Node js Separate String into arrays

javascript,node.js,extract
Got a String which look like this -FirstName (Some Random Name) -LastName (Some Random Last Name) -Age 30 I'm looking for the best and easiest way to extract the First name Last name and Age from this string. So i can store this Data in a Database. The order of...

Why is it still printing

python,string,for-loop,split,extract
I have 2 txt files, one has extra lines. I would like to extract the extra lines only. It keeps printing everything. Why? I am saying if the first line of txt1 is not equal to the first line of txt 2 then print it. import os, sys htmlRub =...

extract buffer mean by simulation (RasterStack)

r,extract,raster
I have two files: a RasterStack (where each layer represents 1 simulated map of air quality index) named m_stack; a SpatialPointsDataFrame (where each point represents a place of residence) named shph; I want to extract mean air quality index of each place of residence, by simulation. To compute mean air...

Extract the text out of HTML string using JavaScript

javascript,html,string,text,extract
I am trying to get the inner text of HTML string, using a JS function(the string is passed as an argument). Here is the code: function extractContent(value) { var content_holder = ""; for(var i=0;i<value.length;i++) { if(value.charAt(i) === '>') { continue; while(value.charAt(i) != '<') { content_holder += value.charAt(i); } } }...

extract(raster,SpatialPoint,buffer). how to change row id's?

r,extract
I have two files: a RasterStack (with 2 layers, each represents a raster map) named m_stack; A SpatialPointsDataFrame (points) named shph (with columns populated with data); i can extract a buffer for each point (bdata) for each layer by doing: bdata<-extract(m_stack,shph,buffer=60, cellnumbers=T) bdata returns a list, row id's of the...

How to remove duplicate lines - only in certain sections? Python 2.7.9

python,python-2.7,parsing,duplicates,extract
I am trying to consolidate a .txt file into a cleaned version of the data. Currently, the file is structured as the following: IDENTIFIER: unique values DATA ONE: more unique values DATA TWO: more unique values DATA TWO: more unique values DATA TWO: more unique values IDENTIFIER: unique values DATA...

Big Query: extract a certain number of signs after a text

extract,google-bigquery
my Database has two columns and looks like Name/ Description Anna/ Home, TEL:123-45678, Fax:123-45679 Ben/ School, no phone,no FAX Clair/ Job,TEL:987-65432, Fax:987-45679 Dave/ Home, TEL:147-85236, no FAX I want eventually to get only those guys who have a phone number and the respective number. Should eventually look like Name/ Description...

R_Extracting data for a particular date form a zoo object

r,extract
Hi I have a zoo time series (interval-1 min) contains rainfall data from multiple rain gauges for a month which looks like head(precApr) RG.1 RG.2 RG..4 RG.5 RG.6 RG.7 RG.8 RG.9 RG.10 RG.12 RG.13 2008-04-06 00:00:00 0 0 0 0 0 0 0 0 0 0 0 2008-04-06 00:01:00 0...

Extract part of a variable in batch

variables,batch-file,extract
@echo off setlocal enabledelayedexpansion for /f "tokens=* delims=" %%g in (list.txt) do ( set var=%%g set var=!var: =*! dir /b "!var!*.txt" > log.txt echo !var! > tempfile.txt for %%? in (tempfile.txt) do ( set /A len=%%~z? - 2 ) for /f "tokens=* delims=" %%g in (log.txt) do ( set var=%%g...

Using Wildcards to Extract Text from Cell String Containing a Specific Value/Character

string,excel,extract,wildcard,worksheet-function
In a cell I have a string of text that contains both a Contact Name and Company Name (example in cell A2: John X. Doe, XYZ Inc.). I have successfully created a formula that uses the "_" (underscore character) that connects Company Name with ending Company Name Suffixes (i.e., _Inc.,...

How to specify Xpath that return whole table without last row?

parsing,table,xpath,extract
Here is the code of a table. I need to extract whole table without last row. Whole table: <table class="product-content__table"> <tr><th class="product-content__th">Состав</th><td>нержавеющая сталь, натуральная кожа </td></tr> <tr><th class="product-content__th">Ширина</th><td>2 см</td></tr><tr><th class="product-content__th">Цвет</th><td>серый </td></tr>...

Extracting all data from a .dat file using Binary Access Read (Application Defined error 1004)

vba,extract,binaryfiles
Blockquote have some files in the .dat format,these files contain some valuable information however they can be quite big, trying to open each file in notepad and extracting the information I need is not efficient at all, as it takes notepad a long time to open each file. I have...

Extract data in every chunk of data.frame depending on variable

r,data.frame,row,extract
I am trying to extract the first record for each chunk (layer) of my data. I want to extract the first appearance of negative value (Mag) in each chunk together with corresponding time. Then I want to compare those "times" from each chunk and find min and max values. (this...

Extract attributes of an string

java,string,attributes,extract
I got to deal here with a problem, caused by a dirty design. I get a list of string and want to parse attributes out of it. Unfortunately, I can't change the source, where these String were created. Example: String s = "type=INFO, languageCode=EN-GB, url=http://www.stackoverflow.com, ref=1, info=Text, that may contain...

Extract data out of HTML table cell

html,vbscript,extract
I want to extract an information from a website (non-public intranet) with VBScript. It is a time which is always in the same field on the website, but each date different and afterwards I want to create with this information a meeting in my outlook (duration always exactly 1 hour)...

Getting contents with extract($variables), but the variables are undefined

php,arrays,variables,model-view-controller,extract
I haven't gotten the hang of the extract() function, and transferring variables. I have a method in a user controller where some variables are defined, and sent in an array to a view function in a parent controller, where the array is extracted. Then the view is required. But the...

How to extract column name of table in matlab

matlab,table,extract,columnname
Can you suggest me a way to extract name of specific column of table in Matlab environment (as string)?

Verilog Input Text Parsing using Python Regex

python,regex,text,extract,verilog
so I'm trying to parse some verilog files using python. I need to find inputs, outputs, etc. However, in some files, some inputs and outputs have multiple bitwidths, like so: input read_enable, input [WIDTH-1 : 0] write_data, I'm using regular expressions to go through the text file one line at...

BigQuery; extract numbers only from a string

split,extract,google-bigquery
my data looks like a 1x1000 vector with variable number of inputs in a like. sometimes it is just age but sometimes they add weight and state ID. 85 age 15 age; 68 Weight 25 age; 80 Weight; 02 Alaska 72 Weight; 50 Wyoming What I would like to get...

How to extract associated icon from a File

java,image,file,extract,jlabel
I have an array of files - File[] files = new File[9] The files extensions are ".lnk" (Windows shortcut files) and I'm wondering how to extract the Image (The actual executable icon that you see in windows explorer...) from each file to set it to a JLabel ? Can anyone...

How to crawl links on all pages of a web site with Scrapy

website,web-crawler,scrapy,extract
I'm learning about scrapy and I'm trying to extract all links that contains: "http://lattes.cnpq.br/andasequenceofnumbers" , example: http://lattes.cnpq.br/0281123427918302 But I don't know what is the page on the web site that contains these information. For example this web site: http://www.ppgcc.ufv.br/ The links that I want are on this page: http://www.ppgcc.ufv.br/?page_id=697 What...

How to extract specific substring from getline function in C++?

c++,string,function,compare,extract
I'm fairly new to C++ so please forgive me if my terminology or methodology isn't correct. I'm trying to write a simple program that: Opens two input files ("infileicd" and "infilesel"). Opens a single output file "list.txt". Compares "infilesel" to "infileicd" line by line. If a line from "infilesel" is...

How to extract data from a file in C

c,data,extract,extraction,text-extraction
I have a .dat file containing 6 columns of N numbers like so: -4.997740e-01 -1.164187e+00 3.838383e-01 6.395961e+01 -1.938013e+02 -4.310365e-02 -1.822405e+00 4.470735e-01 -2.691410e-01 -8.528020e+01 -1.358874e+02 -7.072167e-01 9.932887e-01 -2.157249e+00 -2.303825e+00 -5.508925e+01 -3.548236e+02 1.250405e+00 -1.871123e+00 1.505421e-01 -6.550555e-01 -3.254452e+02 -5.501001e+01 8.776851e-01 1.370605e+00 -1.028076e+00 -1.137059e+00 6.096598e+01 -4.472264e+02 -1.268752e+00 ............ ............ ............ ............ ........... ..............

Get the article to extract title, alias, content, etc. Joomla 3.X [PHP]

php,joomla,get,extract,article
I'm new on this community, and I'll be very grateful if someone can help me with this. Well, I'm trying to get the information from any article, by ID or by [object]. The idea is, "do some actions" for all of these data, extracting the "title", "content", etc. then manipulate...

Python extract text 4 lines after match

python,text,extract
So I've got a textfile and I need to extract a line of text, 4 lines after a specific heading. i.e.: Heading line1 line2 line3 line to be extracted I've been looking for hours for an easy way to do it, but my knowledge of python is too limited to...

Python: method to extract tuple [duplicate]

python,python-3.x,tuples,extract
This question already has an answer here: Expanding tuples into arguments 3 answers I have a tuple of constants: WIN = 640, 360, "Example", False, 'tool' # x, y, title, resizable, style And now to use it I have to type in this: app = pyglet.window.Window(WIN[0], WIN[1], WIN[2], WIN[3],...

Python extracting blocks of text from a file

python,regex,extract
I need to extract two blocks of text from several files and put them in separate lists using python. The first block starts from line 30, and isn't too hard to extract. The second block starts 2 lines after the first block; the issue is that the blocks can be...

Extract text around the reference number in research document [closed]

java,regex,extract,text-mining
I want to extract the text surrounding the reference number. for example: text is : The sociological assumption is a constraint on the trust in the underlying social graph: the graph needs to have strong trust as evidenced, for example, by face to face interaction demonstrating social nodes knowledge of...

Have a string as an integer [duplicate]

c++,integer,extract
This question already has an answer here: How to parse a string to an int in C++? 15 answers Convert string to int C++ [duplicate] 11 answers #include <iostream> using namespace std; int main () { string a; cin >> a; int b=10; cout << a+b; return 0; }...

extract specific text using multiple regex in python?

python,regex,extract
I have a problem using regular expressions in python 3 so I would be gladful if someone could help me. I have a text file like the one below: Header A text text text text Header B text text text text Header C text text here is the end what...

How to extract short sequence using window with specific step size?

python,extract,extraction,biopython,fasta
The code below extract short sequence in every sequence with the window size 4. How to shift the window by step size 2 and extract 4 base pairs? Example code from Bio import SeqIO with open("testA_out.fasta","w") as f: for seq_record in SeqIO.parse("testA.fasta", "fasta"): i = 0 while ((i+4) < len(seq_record.seq))...

Extracting specific parts of a HTML-File with PHP Simple HTML DOM Parser

php,html,parsing,dom,extract
I've got a HTML-File with several tables from which I try to extract the link and image part. I'm using the PHP Simple HTML DOM Parser. Here's the HTML-File to parse: <h1>Title</h1> <p>Text</p> <table cellspacing="0" cellpadding="0" border="0"> <tbody> <tr><td> <a href="http://www.google.com/some_url"> <img width="100" height="100" border="0" src="http://google.com/some_image.jpg"/> </a> </td></tr> </tbody> </table>...

Python Extracting a substring of variable length

python,regex,substring,extract,slice
I'm trying to extra the name of a module from some verilog code. For example: module uart (inputs, outputs, etc) I know I can use pythons slicing to get a substring, but that only uses indexes. I need to make it so that it slices kind of like this: string[6:...

Extracting values from columns in tab delim text file [closed]

regex,r,split,extract
perlI have tab delimited text file with 3 columns like following Name Description Ontology dda1 box1_homodomain gn=box1 os=homo C:Cell;C:surface;F:binding;P:toy dda2 sox2_plurinet gn=plu os=mouse C:Organ;F:transport;P:carrier;P:avi dd13 klf4_iPSC gn=klf os=Bos C:Cell;F:tiad;P:abs;P:digestion Now I would like to split the values (gn=xxx and os=xxx) in column Description and values in Ontology column(C:xxx;F=xxx;P=xxx;) into seperate...

Extracting text following a specific a-tag

python,html,string,beautifulsoup,extract
i have a problem extracting text from a html-code with python. The code looks as followed: <div class="..."> <br/><a href="link1.html" title="title1">anchor1</a>text1 <br/><a href="link2.html" title="title2">anchor2</a>important text to extract <br/><a href="link3.html" title="title3">anchor3</a>text3 ... </div> I want to extract only the text that follows one specific link. I know some words in the...

extract text from string in R

r,string,extract
I have a lot of strings that all looking similar, e.g.: x1= "Aaaa_11111_AA_Whatiwant.txt" x2= "Bbbb_11111_BBBB_Whatiwanttoo.txt" x3= "Ccc_22222_CC_Whatiwa.txt" I would like to extract the: Whatiwant, Whatiwanttoo, and the Whatiwa in R. I started with substring(x1,15,23), but I don't know how to generalize it. How can I always extract the part between...

How to get single file from zip file?

vb.net,extract,unzip
I want to get just one file from .zip file in VB.NET. I don't need to extract all of .zip file, just one file. I'm working with framework 4.5....

How do you extract a string that is in between a char/string in C++?

c++,string,extract
Let's say I have a simple string: string example = "phone number: XXXXXXX," where X are random values given to me, so they are always different. How do I extract only the X's? "phone number: " doesn't change. what I have now (using Thomas Matthews technique below) const char search_text[]...

Extract part of data from JSON file with python

python,json,dictionary,extract,decode
I have been trying to extract only certain data from a JSON file. I managed to decode the JSON and get the wanted data into a python dict. When I print out the dict it shows all the wanted data, but when I try to write the dict into a...

Extract xy coordinates from raster using buffer function

r,buffer,extract,spatial,raster
I have some xy coordinates as a SpatialPoints (points) object and have used them to extract temperature values at these locations from a RasterLayer (raster): extract = extract(raster, points) However several of the points are falling outside of the raster layer (i.e. not plotting on land) and I want to...

How to extract frames from all videos in a folder using ffmpeg

image,video,ffmpeg,extract
I'm currently able to extract images from a file using the following line ffmpeg -i inputfile.avi -r 1 image-%d.jpeg However, I want to apply this to all the files in a folder, and place it in an output folder. Suppose I have the current folder holding all videos: input-videos/ ----subfolder1/...

Extract string with whitespace inside Perl Regex

regex,string,perl,extract
I have some troubles trying to get arguments after equal sign, but argument can include string in quotes with spaces inside I cannot figure out how to get arguments separated by space including spaces if quotes are specified. name=MyName lastname='John Black' fathername='Bill Gen' age=30 The result should be following %result...

Extracting from remote JSON

php,json,extract
I have the JSON url: http://www.lfsworld.net/pubstat/get_stat2.php?version=1.5&idk=5GvgiUmwdVfkZXQdoKOK0aN5LTOzS9Yo&action=hosts&s=1 I am looking to get a certain line where "hostname" is equal to $host, and to then get the value of the "nrracers". I have the below so far that will just get me the whole file in a different form. <?php $host =...

How to extract specific lines from a huge data file?

text-files,extract,large-files,data-files
I have a very large data file, about 32GB. The file is made up of about 130k lines, each of which mainly contains numbers, but also has few characters. The task I need to perform is very clear: I have to extract 20 lines and write them to a new...

Copying data from text into new columns in R

r,extract,social-networking
I have compiled a dataset of tweets using the Twitter API. The dataset basically looks as follows: Data <- data.frame( X = c(1,2), text = c("Hello @User1 #hashtag1, hello @User2 and @User3, #hashtag2", "Hello @User2 #hashtag3, hello @User1 and @User3, #hashtag4"), screenname = c("author1", "author2") ) Now I want to...

Extract string from between quotations python 3.4 serial port

python,extract,pyserial,quotations
I want to identify which serial port of my computer is being used, to do so I have (VSPE which is a virtual serial port emulator just like Eltima virtual serial port driver 7.1) and the following code import sys import glob import serial def serial_ports(): """Lists serial ports :raises...

python pandas extract year from datetime — df['year'] = df['date'].year is not working

python,datetime,pandas,extract,dataframes
Sorry for this question that seems repetitive - I expect the answer will make me feel like a bonehead... but I have not had any luck using answers to the similar questions on SO. I am importing data in through read_csv, but for some reason which I cannot figure out,...

C: How to extract numbers from string without strtol

c,numbers,extract
I have problem with extracting numbers from string. Problem is I can not use strtol or isdigit functions as teacher requested so. I am supposed to save numbers in new array. For example, string input: 11-some12meh13text-14 . So new array would be: 11,12,13,14 (NOT -14) I came to idea to...