logo
Tags down

shadow

Extract info using awk


By : Dmitriy Strelkov
Date : October 14 2020, 08:10 PM
To fix this issue Considering that your actual Input_file is same as shown samples. Could you please try following.
code :
awk -F'|' '{for(i=2;i<=NF;i++){sub(/_.*/,"",$i);val=val?val OFS $i:$i};print val;val=""}'  OFS=","  Input_file
awk '{sub(/^[^|]*\|/,"");gsub(/_[0-9]\|/,",");sub(/_[0-9]$/,"")} 1' Input_file
OR
awk '{gsub(/^[^|]*\||_[0-9]$/,"");gsub(/_[0-9]\|/,",")} 1' Input_file
line1,line2,line3
awk -F'|' '                    ##Setting field separator as | here for all lines.
{                              ##Starting block here.
  for(i=2;i<=NF;i++){          ##Starting for loop starting form i=2 to till value of NF here.
    sub(/_.*/,"",$i)           ##Using sub for substitution from _ to till everything with NULL in value of $i.
    val=val?val OFS $i:$i      ##Creating variable val and concatenate its own value if it is having NON ZERO value else save in it for 1st time.
  }                            ##Close for loop block here.
  print val                    ##Printing value of val here.
  val=""                       ##Nullifying value of variable val here.
}'  OFS=","  Input_file        ##Setting value of OFS to comma here and mentioning Input_file name here.


Share : facebook icon twitter icon

best way to extract info from the web delphi


By : Donato.Pestana
Date : March 29 2020, 07:55 AM
it helps some times I found plain simple regex-es to be highly intuitive and simple when dealing with good web-sites, and IMDB is a good web site.
For example the movie rating on the IMDB's movie HTML page is in a
with class="star-box-giga-star". That's VERY easy to extract using a regular expression. The following regular expression will extract the movie rating from the raw HTML into capture group 1:
code :
star-box-giga-star[^>]*>([^<]*)<

How do I extract info from a webpage?


By : nunu
Date : March 29 2020, 07:55 AM
I hope this helps you . After downloading the contents, use an HTML Parser such as HTML Agility Pack to identify the span element belonging to the jix_channels_count class.
Another option is SgmlReader.
code :
var url = "www.that-website.com/foo/";
var myRequest = (HttpWebRequest)WebRequest.Create(url);
myRequest.Method = "GET";
WebResponse myResponse = myRequest.GetResponse();                
var responseStream = myResponse.GetResponseStream();
var sr = new StreamReader(responseStream, Encoding.Default);
var reader = new SgmlReader
             {
                 DocType = "HTML",
                 WhitespaceHandling = WhitespaceHandling.None,
                 CaseFolding = CaseFolding.ToLower,
                 InputStream = sr
             };
var xmlDoc = new XmlDocument();
xmlDoc.Load(reader);
var nodeReader = new XmlNodeReader(xmlDoc);
XElement xml = XElement.Load(nodeReader); 

page using JS to display info - need to extract that info


By : Quaintrovert
Date : March 29 2020, 07:55 AM
Hope that helps Maybe you could use this tutorial
http://www.1stwebdesigner.com/tutorials/php-crawler-tutorial/ (requires some PHP and REGEX skills)
code :
<td class="tweets">*<td>
<td class="tweets">91,621<td>

extract info out of XML tag - RUBY


By : Jet_Set_Willy
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I have an xml tag like this
code :
str = '<cvParam cvRef="MS" accession="MS:1000511" name="ms level" value="1"/>'

md = str.match(/
     name="(.*?)"        #Match name=" followed by any character(.), 0 or more times(*), captured in group 1 (), followed by...
     \s*                 #whitespace(\s), 0 or more times(*), followed by...
     value="(\d+)"       #value=", followed by a number(\d), one or more times(+), captured in group 2 ().
/x) #x-flag: ignore whitespace in pattern, which allows you to write the regex on mutliple lines and add comments like these.

if md
  name, value = md.captures   #captures => an Array containing the matches for each of the parenthesized groups in the regex.
  puts "#{name}(#{value})"
end

--output:--
ms level(1)

How does one extract info from the 'More Info' of finder?


By : wesam80
Date : March 29 2020, 07:55 AM
it should still fix some issue You can find most, if not all, of that in the Spotlight metadata store, for example:
code :
do shell script “mdls “ & quoted form of “/posix/path/to/file”
Related Posts Related Posts :
shadow
Privacy Policy - Terms - Contact Us © voile276.org