Need to extract only decimal numbers for a glob of text [SOLVED]

If you have a look at /dev/zero's thread here, you'll see that users have been posting the output of his script which are numbers that range from 2 to 5 decimal places.  If I dump this entire thread to txt file, how can I:
1) Delete everything except for numbers of the following formats (where 'x' is a digit and '.' is a decimal point)?
2) Format the output to be one target per line?
x.xx
x.xxx
x.xxxx
x.xxxxx
xx.xx
xx.xxx
xx.xxxx
xx.xxxxx
I have experimented with some sed strings but am not making any traction.  Perhaps your perl or awk ninjas have a good solution?
Here is the source file which was generated from a copy/paste of that thread into an empty text file: http://pastebin.com/ZkRFhFAr
Last edited by graysky (2012-12-21 11:19:05)

Ooh, a challenge...
* 1 hour later *
#!/usr/bin/perl -an
@ary = grep /^\d{1,2}\.\d{2,5}$/, @F;
print join("\n", @ary) . "\n" if @ary;
Run as ./script.pl unixness_thread.txt
Not perfect, it grabs 10.04 which is an Ubuntu version in context, and 4.10 which is an Xfce version... but not too far off. Stick a "sort -n" on the end and knock off the obvious outliers and you'll be half there.
Edit -- just noticed it skips at least one number in parentheses: (8.73086). Was thinking the default splitting behavior would not be a problem but I was wrong. Not sure how to fix this but I think it can be done with -F.
Edit again -- changing the shebang as follows seems to work:
#!/usr/bin/perl -an -F/[^\d\.]/
Last edited by Trent (2012-12-21 01:55:08)

Similar Messages

  • Need to extract only file name from path.........

    Hi All,
    I have a parameter.This calls the function
    "CALL FUNCTION 'F4_FILENAME' to get the file from C drive.
    After selecting the file the path is displayed in the Parameter field.
    My problem is I need to extract only file name from the path.Please advice.
    Example : Prameter  id    C:\folder\file.xls  
    I shd extract only file.xls from the path.Please advice.

    Hi,
    Use the below logic:
    data: begin of itab,
               val    type  char20,
            end of itab.
    SPLIT  l_f_path  AT  '\'  INTO  TABLE itab.
    The last record of the internal table holds the file name.
    describe table itab lines l_f_lines.
    read itab index l_f_lines.
    l_f_filaname = itab-val.
    Hope this helps u.

  • Need to install only the query for fi account receivables standard data ?

    Hi all,
    I need to insall only the query for the standard business content for fi_ar in bw 3.5 ?
    i have selected the cube and then in grouping i have selected data flow afterwards only.
    And i have selected the queries only. but the cube is selected again. Should i uncheck the cube and install only the queries and transport it?
    Pls guide me on this!!
    Thanks
    Pooja

    Hi,
    If the required cube is already avaialble and continue with the existing design, you can uncheck the cube and install only queries. Check all the prerequisites before installing queries like used infoobjects, other targets if any.
    Hope this helps,
    Regards,
    Rama Murthy.

  • SOAP APIs needed to extract SOAP request arguments for message handler implementation

    1. I am facing problem in using the Message Handler approach for the implementation
    of webservices using SOAP on BEA weblogic 8.1. A SOAP request(XML format) can
    be interrupted using the message handler and hence can be modified before it invokes
    the webservice method. I have been able to successfully extract the SOAP Name
    space xml format as a part of the SOAP request using the APIs given below
    APIs:
    SOAPBody body = env.getBody();
    Name Spaces format:
    <m:sayHello xmlns:m="http://www.bea.com/servers/wls70/samples/examples/webservices/basic/statelessSession">
    <intVal xsi:type="xsd:int">100</intVal>
    <string xsi:type="xsd:string">vikas</string>
    </m:sayHello>
    The above is a Hello world example which invokes the sayHello method with arguments
    as an integer and a string. I have not been able to find the SOAP APIs to extract
    these arguments from the SOAP Body.
    2. But there are XML apis which can extract the tag data from the SOAPBody e.g
    NodeList nl = body.getChildNodes();
    for(int i = 0; i < nl.getLength(); i++)
    Node node = (Node)nl.item(i);
    if(node instanceof SOAPElement){
    SOAPElement se = (SOAPElement)node;
    String operationName = se.getLocalName();
    String value = se.getValue();
    The SOAPBody interface implements the following interfaces (Ref : http://java.sun.com/j2ee/1.4/docs/api/index.html
    javax.xml.soap > SOAPBody )javax.xml.soap.Node, javax.xml.soap.SOAPElement(SOAP APIs)
    org.w3c.dom.Node, org.w3c.dom.Element (XML Parser APis)
    3. But webservice implementation of Weblogic Application server 8.1(webservice.jar)
    doesn't support the XML parser APIs and only supports the SOAP APIs.
    i.e. The SOAPBody Interface of Weblogic Application Server only implements the
    javax.xml.soap.Node, javax.xml.soap.SOAPElement (SOAP APIs) and not the XML APIs
    (org.w3c.dom.Node, org.w3c.dom.Element)
    So the code snippet written as a part of point 2 will not be compiled(give compilation
    error) using the webservice.jar of Weblogic 8.1.
    4. I have tried to compile the same code using the saaj-1_2-fr-api.jar (SOAP 1.2
    apis jar) which I have downloaded from java.sun site. And the code got successfully
    compiled.
    In this latest version of SOAP APIs jar the SOAPBody interface implements both
    the SOAP as well as XML parser Apis.
    5. I was not able to run this code on the Weblogic server , bcoz at the runtime
    weblogic 8.1 is using its webservice.jar instead of saaj-1_2-fr-api.jar. And
    this code was giving me runtime error as
    java.lang.NoSuchMethodError: javax.xml.soap.SOAPBody.getChildNodes()Lorg/w3c/dom/NodeList;
    (see Fault Detail for stacktrace)</faultstring>
    So now I need to find out the version of the webservice.jar of Weblogic 8.1 which
    supports SOAP Apis as well as XML parser apis.
    Otherwise I have to find out the SOAP apis which can extract the tag data from
    the SOAP body.
    Please Help.

    You can use the SAAJ APIs to get the child nodes.
    Example here:
    http://manojc.com/tutorial/sample4/ServerHandler.java
    so instead of using body.getChildNodes(), you have to use
    body.getChildElements() which returns an iterator of SOAPElements.
    Regards,
    -manoj
    http://manojc.com
    "Vikas Garg" <[email protected]> wrote in message
    news:40dfb5e0$1@mktnews1...
    >
    1. I am facing problem in using the Message Handler approach for theimplementation
    of webservices using SOAP on BEA weblogic 8.1. A SOAP request(XML format)can
    be interrupted using the message handler and hence can be modified beforeit invokes
    the webservice method. I have been able to successfully extract the SOAPName
    space xml format as a part of the SOAP request using the APIs given below
    APIs:
    SOAPBody body = env.getBody();
    Name Spaces format:
    <m:sayHelloxmlns:m="http://www.bea.com/servers/wls70/samples/examples/webservices/basic
    /statelessSession">
    <intVal xsi:type="xsd:int">100</intVal>
    <string xsi:type="xsd:string">vikas</string>
    </m:sayHello>
    The above is a Hello world example which invokes the sayHello method witharguments
    as an integer and a string. I have not been able to find the SOAP APIs toextract
    these arguments from the SOAP Body.
    2. But there are XML apis which can extract the tag data from the SOAPBodye.g
    >
    NodeList nl = body.getChildNodes();
    for(int i = 0; i < nl.getLength(); i++)
    Node node = (Node)nl.item(i);
    if(node instanceof SOAPElement){
    SOAPElement se = (SOAPElement)node;
    String operationName = se.getLocalName();
    String value = se.getValue();
    The SOAPBody interface implements the following interfaces (Ref :http://java.sun.com/j2ee/1.4/docs/api/index.html
    javax.xml.soap > SOAPBody )javax.xml.soap.Node, javax.xml.soap.SOAPElement(SOAP APIs)
    org.w3c.dom.Node, org.w3c.dom.Element (XML Parser APis)
    3. But webservice implementation of Weblogic Application server8.1(webservice.jar)
    doesn't support the XML parser APIs and only supports the SOAP APIs.
    i.e. The SOAPBody Interface of Weblogic Application Server only implementsthe
    javax.xml.soap.Node, javax.xml.soap.SOAPElement (SOAP APIs) and not theXML APIs
    (org.w3c.dom.Node, org.w3c.dom.Element)
    So the code snippet written as a part of point 2 will not be compiled(givecompilation
    error) using the webservice.jar of Weblogic 8.1.
    4. I have tried to compile the same code using the saaj-1_2-fr-api.jar(SOAP 1.2
    apis jar) which I have downloaded from java.sun site. And the code gotsuccessfully
    compiled.
    In this latest version of SOAP APIs jar the SOAPBody interface implementsboth
    the SOAP as well as XML parser Apis.
    5. I was not able to run this code on the Weblogic server , bcoz at theruntime
    weblogic 8.1 is using its webservice.jar instead of saaj-1_2-fr-api.jar.And
    this code was giving me runtime error as
    java.lang.NoSuchMethodError:javax.xml.soap.SOAPBody.getChildNodes()Lorg/w3c/dom/NodeList;
    (see Fault Detail for stacktrace)</faultstring>
    So now I need to find out the version of the webservice.jar of Weblogic8.1 which
    supports SOAP Apis as well as XML parser apis.
    Otherwise I have to find out the SOAP apis which can extract the tag datafrom
    the SOAP body.
    Please Help.

  • Need help with formula in Numbers for iPad 2

    I have a spreadsheet with a formula such as b2 x c2  very simple.  However, if the formula cells (b2 and 2) are blank then the destination cell contains a zero. How can I make my destination cell b blank while the formula cells are blank? I got thsvresponse from a person working with Mac os x, if this helps...
    I can't seem to make this work in my formula bar on ipad2!
    =if(isblank(<source cell>), "", <What ever your formula is>)
    Thanks for any suggestions!
    iPad 2

    Your friend was close, but forgot one thing. If you want it to be blank if either cell is MT, then you need an OR as well o test if either one or the other is blank...
    =IF(OR(ISBLANK(a1),ISBLANK(b1)),"",a1xb1)
    The isblank can also be represetned by ="" in many cases, usually accompanied with a trim to make sure there are no spaces were entered...
    =IF(OR(TRIM(a1)="",TRIM(b1)="")),"",a1xb1)
    Jason

  • Need to Extract Image from Database for Report

    Greetings,
    I have two databases that I could work with; both are for card access users.  One is an old Access 98 database, the other is a SQL database,
    In the tables I can "see" references to employee_photo and badge_picture_path respectively, but when I run the Report, the Image is not retrieved.
    Any ideas how I can overcome this ?
    I am trying to create a hard copy in a binder, so that new guards can thumb through the binder and familiarize themselves with employees.
    Thanks
    Peter

    Hi Peter,
    What format are the pcitures saved in.  I believe they have to be either BMP or JPEG.  Any other formats will not work in Crystal. 
    Have a look with the sample Extreme database.  The Employee table has a picture field, very similar to what you are using.  If you create a simple report with it, can you see the pictures? 
    Thanks,
    Brian

  • I need to parse a String and get only the numbers in the String.

    I have a string like this
    <div class="leader"><div class="leaderLeft">Top Wraps:</div><div class="leaderRight">4</div></div><br/><div class="leader"><div class="leaderLeft">Bottom Wraps:</div><div class="leaderRight">2</div></div><br/><div class="leader"><div class="leaderLeft">Spiral-Up:</div><div class="leaderRight">3</div></div><br/><div class="leader"><div class="leaderLeft">Spiral-Down:</div><div class="leaderRight">3</div></div><br/>and I need to get only those numbers out of it. I came up with a way to kind of do it using patterns and splitting the text but that doesn't help me because sometimes the string is a little different. Like this:
    <div class="leader">
         <div class="leaderLeft">Top Wraps:</div>
         <div class="leaderRight">2</div>
    </div><br/>
    <div class="leader">
         <div class="leaderLeft">Bottom Wraps:</div>
         <div class="leaderRight">2</div>
    </div><br/>
    <div class="leader">
         <div class="leaderLeft">Spiral-Up Wraps:</div>
         <div class="leaderRight">3</div>
    </div><br/>
    <div class="leader">
         <div class="leaderLeft">Spiral-Down Wraps:</div>
         <div class="leaderRight">3</div>
    </div><br/>It has paragraph spacers in it. Is there anyway to possibly do this. I have tried everything I could think of. Thanks a bunch guys.

    dothedru22 wrote:
    The only problem I'm having is find tutorials working with strings with xpath. All the ones I've found were working with .xml files.That's the least of your problems. Just change the example so that instead of parsing from a file, they parse from a StringReader.

  • Update TIN numbers for BP Customer and Vendor Records

    Hi experts
    Needed to update the TIN numbers for existing vendors and customers in SAP B1,please let me know the  templates and necessary field to update the same
    Regards
    Srinivasan

    Hi Bishal
    Taxpayer Identification Number (TIN) and Employer Identification Number (EIN) are defined as a nine-digit number that the IRS assigns to organizations. The IRS uses the number to identify taxpayers who are required to file various business tax returns. TIN/EIN are used by employers, sole proprietors, corporations, partnerships, nonprofit associations, trusts, estates of decedents, government agencies, certain individuals, and other business entities.
    there is a option to enter TIN numbers for BP master records---> accounting -
    > Select Radio Button ---> TIN numbers i want to update these numbers through DTW
    Regards
    Srini

  • Changing Decimal Places for Currencies (Table V_TCURX)

    The instance is ECC 6.0
    We need to change the decimal places for a currency from 0 to 2 decimal places. Is there any impacts of doing that?
    Also need to add some currencies which are not in the table. Is there anything need to be careful while doing this. If this table is updated, do we need to update any other tables also which may be impacted?

    Hi,
    It is not recommended that when postings have already been made, that a change in the currency be done, as amounts posted can become invalid or incorrect as a result (ie USD 100->1.00), which is most critical in production environment Please go through the note 137626 When you made changes via OY04, the effect of which is across all clients.
    To change the number of decimal places for a currency already in use, you must convert all the tables in the R/3 System that contain currency fields, so that the data integrity remains. This cannot, however, for both organizational reasons and under the runtime aspect, in a productive system.
    You must never change decimal places in a productive system if you have documents posted with this currency. Such a change could lead to inconsistencies in these documents already posted.
    In case you really decide to use decimals you may consider to use SAP conversion services for them to convert all documents aready posted as explained in note 434349.
    Additional inforamtion:
    Note No.  137626 - FAQ: Decimal places for currency codes
                     126857 - Display of amts with correct decimal places in SE16
                       53206 - Processing of currency fields
                         9574 - Currency fields on selection screens
    Regards
    Ravinagh Boni

  • Order numbers for digital subscriptions

    I'm going to be giving my iPad to someone next week and I need to locate the order numbers for my magazine subscriptions. Does anyone know how to do this?

    Lol wow. No you have 14 days upon receiving phones. Enjoy that beautiful quad display

  • WEB UI- only Display authorization for LEADS to users

    Hi Gurus,
    I have a requirement like i need to give only display authorizations for users to leads.
    I have created a new business role and assigned only search links. but in that search link we have Create New option. How i need to disable this.
    Users needs only display authorizations for Leads.
    Waiting for reply...
    Regards,
    Ajay.

    Hi Ajay,
    First of all, It is possible to disable the New button on the Search page without any code change. There is an SPRO setting which is to be done in order to achieve this.
    You might have created a new z navbar profile as you have created a new business role as per your business requirement.
    Lets take an example, you want to disable the New button on Contact Search Page. follow these steps:
    1.Go To T. code /ncrmc_ui_nblinks
    2. Select the Z navbar profile you have created for your business role
    3. Double Click on "Define Generic OP Mapping" in left hand side
    4. Select Object Type as BP_CONTACT and remove the Following entry
    BP_CONTACT     D Create     MD-BPCP-CR          MD-CONP-SR
    Please note the Obj. Action here D Create, if you remove this entry it means you are disabling the Create Action for this business role for object Contact.
    Hope this will help you.
    Regards
    Ajay

  • How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    Si vous avez utilisé la commande Save As Template depuis Pages, il y a forcément un dossier
    iWork > Pages
    contenant Templates > My Templates
    comme il y a un dossier
    iWork > Numbers
    contenant Templates > My Templates
    Depuis le Finder, tapez cmd + f
    puis configurez la recherche comme sur cette recopie d'écran.
    puis lancez la recherche.
    Ainsi, vous allez trouver vos modèles personnalisés dans leur dossier.
    Chez moi, il y en a une kyrielle en dehors des dossiers standards parce que je renomme wxcvb.template quasiment tous mes documents Pages et wxcvb.nmbtemplate à peu près tous mes documents Numbers.
    Ainsi, quand je travaille sur un document, je ne suis pas ralenti par Autosave.
    Désolé mais je ne répondrai plus avant demain.
    Pour moi il est temps de dormir.
    Yvan KOENIG (VALLAURIS, France)  mercredi 23 janvier 2011 22:39:28
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • What are the steps needed to make the field in the DFF Additional Information for Agent only take numbers, commas & hyphens?

    Hello All,
    What are the steps needed to make the field in the DFF Additional Information for Agent only take numbers, commas & hyphens?
    Navigation
    Bob Sales manager<Ebiz form<service request tab<SR type<DFF<additional information for agents <cheque number
    The field Cheque number Character allowed (, -) in the DFF Additional Information for Agent should only take numbers
    Thanks & Regards
    Ayesha

    Thanks Sridar
    If we use Number we cannot separate the cheque numbers with , or -
    We need to enter numbers along with comma and '_' in cheque number field.
    Thanks & Regards
    Ayesha

  • Need help with a activation code for Adobe Acrobat X Standard for my PC,, Don't have older version serial numbers,  threw programs away,  only have Adobe Acrobat X Standard,  need a code to unlock program?

    Need help with a activation code for Adobe Acrobat X Standard for my PC, Don't have older Version of Adobe Acrobat 9, 8 or 7. 

    You don't need to install the older version, you only need the serial number from your original purchase. If you don't have them to hand, did you register? If so, they should be in your Adobe account. If not you really need to contact Adobe, though it isn't clear they will be able to do anything without some proof of purchase etc.

  • In Siri, I can call by my voice, but why I can not use Siri voice call in my country (Laos), just can call only us phone number; my country we use like 3 number for option call, 8 numbers for call friend but Siri cannot use this please help us, thanks

    In Siri, I can call by my voice, but why I can not use Siri voice call in my country (Laos), just can call only us phone number; my country we use like 3 number for option call, 8 numbers for call friend but Siri cannot use this please help us, thanks
    And please help me can type Laos font in it like andrio phone.

    Hi Cozumel,
    Thanks for posting. I'm sorry you're having problems with your bills. I can take a look at this for you. Drop me an email with your account details and a link to this thread for reference. You'll find the address in my profile.
    Cheers
    David
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

Maybe you are looking for

  • How do I use both a GUI switch and a timer to control an output?

    Hi, I have no trouble setting up either a gui switch or a timer to switch a hardware output. However, now I am trying to use both to control the same output. That is, the latest change of either the timer or gui switch changes the output. I can do th

  • ABAP Proxy doesnu2019t Work

    Hi all, We have problem about ABAP Proxy (Inbound). We are using a follow scenario: Legacy ( JDBC )    ->   XI  ->  ABAP Proxy ( ECC Backend ) Recently The ECC Backend was updated  ( only data ) , and since than the ABAP Proxys  doesnu2019t work.  We

  • I need help deauthorizing all computers

    I have already tried to find the answer to this question in the FAQs, but the option to deauthorize all computers once I sign in on iTunes didn't show up. I do have 5 computers authorized at this point though because it says "5 out of 5 computers suc

  • VERTICAL ALIGNMENT ON WORD TABLE IS MISS.

    Hello everybody, Can somebody clear my mind? I did the code below, and this generates a beautiful and clean table on word 2010. The problem is that the instruction “.Rows.Height = 8” and  “.Cells.VerticalAlignment = Word.WdCellVerticalAlignment.wdCel

  • Register a product purchased in the USA in another country

    Can I register a CS6 Suite purchased in the USA in my son's computer in México?