Find multiple instances of different specific text on each line in a file

I have a text file that is generated every few weeks that looks something like this:
Pick 1 - <A href="../teams/team_45.html">Guelph Royals</A>: SP <A href="../players/player_6153.html">Curt Amador</A> </TD></TR>
Pick 2 - <A href="../teams/team_34.html">Hillsborough Highlanders</A>: 3B <A href="../players/player_8813.html">Zach Watson</A> </TD></TR>
Pick 3 - <A href="../teams/team_40.html">Brooklyn Hoodrats</A>: SP <A href="../players/player_4162.html">Jerry Davis</A> </TD></TR>
Pick 4 - <A href="../teams/team_47.html">Toronto Titans</A>: SP <A href="../players/player_9776.html">Toby Walker</A> </TD></TR>
(and so on through about 50 lines)
I want to run the data through a script that extracts only parts of each line. I need:
1) the Pick # (everything before the "-"
2) the player's position number (the two characters before the second "<A href=" I.E. "SP" or "3B")
3) the 4 digit player number (the 4 digits after "/players/player_"
4) the player's name (everything between ".html">" and "</A> </TD></TR>"
I'm not nearly as up on my text manipulation as I should be, and I know stripping out text that has quotes is going to mess me up. Would someone be able to show me a way to do this and perhaps even explain their code?
Thank you in advance.
[email protected]

That's probably going to be easiest with a regex.
$text =
Pick 1 - <A href="../teams/team_45.html">Guelph Royals</A>: SP <A href="../players/player_6153.html">Curt Amador</A> </TD></TR>
Pick 2 - <A href="../teams/team_34.html">Hillsborough Highlanders</A>: 3B <A href="../players/player_8813.html">Zach Watson</A> </TD></TR>
Pick 3 - <A href="../teams/team_40.html">Brooklyn Hoodrats</A>: SP <A href="../players/player_4162.html">Jerry Davis</A> </TD></TR>
Pick 4 - <A href="../teams/team_47.html">Toronto Titans</A>: SP <A href="../players/player_9776.html">Toby Walker</A> </TD></TR>
'@).split("`n") |
foreach {$_.trim()}
$regex = 'Pick (\d+) - <A href=".+?">.+?</A>: (..) <A href=".+?player_(\d{4}).html">(.+?)</A> </TD></TR>'
$text |
foreach {
if ($_ -match $regex)
[PSCustomObject]@{
Pick = $Matches[1]
Position = $Matches[2]
Number = $Matches[3]
Name = $Matches[4]
Pick Position Number Name
1 SP 6153 Curt Amador
2 3B 8813 Zach Watson
3 SP 4162 Jerry Davis
4 SP 9776 Toby Walker
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

Similar Messages

  • Program to read only specific words in each Line in a text file

    Hi
    I have a question
    I need to write a program where the program must read only specific words in each line
    I will give you an example...
    PSAPPSRV.21201      1-42 13.35.54 238.360 Cur#1.HDEV RC=0 Dur=0.000 COM Stmt=SELECT VERSION FROM PSVERSION WHERE OBJECTTYPENAME = 'SYS'
    PSAPPSRV.21201      1-43 13.35.54 0.040 Cur#2.HDEV RC=0 Dur=0.000 COM Stmt=SELECT STYLESHEETNAME FROM PSOPTIONS
    These are two lines in my text file...now I need to read only the SQL statements present that is both SELECT statements.. Can you please suggest a method.......

    My first reaction to the question is why would you want such thing, but may be I am unknown :)
    Assuming you have the text as string, I mean
    String str = "PSAPPSRV.21201 1-42 13.35.54 238.360 Cur#1.HDEV RC=0 Dur=0.000 COM Stmt=SELECT VERSION FROM PSVERSION WHERE OBJECTTYPENAME = \'SYS\'";you can obtain the sql statement using substring method like
    String result = str.substring(str.indexOf("SELECT")); Again I assume there is no word SELECT preceding and the word SELECT is all caps.

  • I did a COPY of some text from a web page, and then did a PASTE into notepad.exe (Windows). The text from each line was duplicated -- on the line! Instead of "Fred", it became "Fred Fred".

    I just recently installed Firefox for the first time. It seems nice and quick. The version is reported as: "10.0.1".
    I wanted to save some text from a web page, so navigated to that page, selected the text, and pressed the Control-C combination to COPY the selected text to the buffer. For example, the text I selected looked something like this:
    Harry
    Ron
    Hermione
    Hagrid
    Albus
    NOTE: Each line of text has a small icon to the left of the text.
    It is not reasonable to COPY and PASTE each line individually, as there can be hundreds of lines of data. I recall, however, that
    doing a COPY and PASTE on this data into Microsoft's Excel will produce cells which have the icons included in the cell, but unfortunately one cannot can't get rid of them! At least I've never found a way to remove them, but that's another issue. :)
    Once I'd done the COPY operation I switched to a Notepad window and did a PASTE operation. To my surprise, the text from each line was duplicated. It looked like this:
    Harry Harry
    Ron Ron
    Hermione Hermione
    Hagrid Hagrid
    Albus Albus
    Thinking that there might be something unusual about the web page I looked at the source, but it appeared "normal" -- that is, as expected.
    Note: I have done this operation several times before, and have never seen this occur before.
    Note: In the actual data some of the lines have quoted text in them. Curiously there is weird behavior on these lines. In some cases the entire line is shown only once. (These occur at the top of the line, and the quoted text is at the beginning of the name.)
    When quoted text appears "later" in the name, in some cases the quoted text is duplicated, and in other cases the quoted text is missing altogether! I have also noticed an error with the quoted text, and so will be reporting that to the web site which generates the HTML.
    Note that each line of "text" is "anchor text", so if I click on a name the browser navigates to a page for that name.
    I believe that the problem is that the COPY operating in Firefox is not simply copying the visible text, but also the ALT=
    Below is a sample of what the source HTML looks like:
    &lt;a class="lnk" target="_blank" href="http://details.aspx?id=Harry">
    &lt;img width="16" height="16" alt="Harry" class="tb_icon" src="http://.../Harry.gif"/>
    &lt;span>Harry&lt;/span>&lt;/a>
    <br/>
    (Because of the true length of the lines in the source HTML, I have stripped out the actual URL of the site.)
    To make sure I wasn't imaging this difference I repeated the process within Internet Explorer. In that browser I did not get duplicated data.

    Try:
    *Extended Copy Menu (fix version): https://addons.mozilla.org/firefox/addon/extended-copy-menu-fix-vers/

  • How to get the texts for each line item for Sales order in a smartform

    I'm createing a smart form in which i need to display certain texts for each line item of a sales order. How can i get those??
    I'm trying with the table STXH and FM read_text... but i'm not clear how and what i'm getting... can anybody pls help me.....

    Hi There,
    But then i will be getting only the value. i want to link that against the particular material of the Purchase Order.
    Like for ex:
    PO No.  Material Code        Line Item        Basic        Excise       Tax       Inv Value
    0000001 5000251                010               100           16         4.64      120.64
    0000001 5000252                020               200           32         9.28      241.28
    Can u help me on this?
    Regards,
    Jitesh

  • Multiple copies with different footer text --sapscripts

    Hello I have a requirement where in i need to print multiple copies( customer, company, etc). On each copy different footer text is to be printed. Can anyone help me out. Thankyou helpful posts will be rewarded.

    Hi,
    If you have a need wherein the samrtform has to have data differ for each copy of a printout
    eg. Different form title per every print copy.
    then the following code should work.
    case sfsy-copycount0.
    When 000.
    form_title  = 'Order confirmation'.
    when 001.
    form_title = 'Warehouse ticket'
    when 0002.
    form_title = 'Customer ticket'.
    endcase.
    Remember, display the element 'form_title' in a window of type 'copies window'.
    Reward if helpful.
    Regards
    Pavan.

  • Re: Running weblogic multiple instances on different ports

    Hi,
    I am planning to run multiple weblogic instances on different ports on the
    same machine.
    Is it possible ? If so, how ?
    Details:
    I am using IIS on the same machine. I am currently running weblogic on
    7001 and 7002(ssl).
    I dont how to run multiple instances. Please help me or guide me where I
    can get documentation.
    These two instances have to refer two different set of code bases ...
    Please point me where I can more details.
    Thanks in advance.
    Sreedhar V

    Is it possible for the two instances on the same machine to participate in
    the same cluster? I believe servers in a cluster must share the same port
    (which is also used for multicasting). Does a virtual IP address need to be
    configured?
    "Per Jessen" <[email protected]> wrote in message
    news:[email protected]..
    >
    >
    Sreedhar Vankayala wrote:
    Hi,
    I am planning to run multiple weblogic instances on different ports on
    the
    same machine. Is it possible ? If so, how ?Assuming you are using WLS6.x, simply define as many servers as needed andgive
    them different ports to listen to. This is easily accomplished using theWLS
    Admin Console.
    Then start individual weblogic processes using this config file.
    regards,
    Per Jessen, Zurich.

  • Each line of a file to a single Idoc (one file to multiple IDoc)?

    Hi Community,
    I have a flat file with many lines. Each of these lines has the same structure and has to fill a separate IDoc. How can I configure XI that it creates for each line a separate IDoc?
    I already found a blog to such a topic: File to Multiple IDocs (XSLT Mapping)
    But thatu2019s not what I am looking for (or I do not get the Point).
    I also tried to set u201CRecords per Messageu201D to 1. But that is not working to. :/
    Maybe one of you guys has an idea?
    Thanks in advance,
    Udo

    Hi Udo,
    For instance if  file structure is as follows:
    <File>
    <Header>
    </Header>
    <Item>
    </Item>
    <Item>
    </Item>
    </File>
    Now if u want to genarate a new Idoc for each n every <Item> in the file. The Header Information is to be repeated for each IDOC as well.
    Then allu need to do is  import the idoc in XI, then take the idoc xsd and change the occurrence o..unbound and then create the external definition.
    Look into this blog.
    The specified item was not found.
    Now use the external definition in your mapping instead of using the original IDOC. In your mapping map the item to IDOC, and for header data you have to use the useOneAsMany function.
    Reward if found useful
    Regards,
    Vinod.

  • Open Item interest calculation with different exchange rate for each line

    Dear All
    We have a short term loan facility with our Bank. We take short term loan with bank on different terms and condition. Now user has requirement to have different interest rate for each open items depending on the posting date or any other condition. I think in SAP for one bank account only one rate is applicate for validity from date.
    Can someone share his/her experience if got the same requirement from user
    Thanks and Best Regards
    Farhan Qaiser

    Dear Ashwin,
    As of overdue days are concerned there is no standard functionality available whereas there is for amount.
    Better solution is that you get an ABAPer create your own functional module. That will help you in better way.

  • Fi document: different tax code for each line item

    Dear All,
    Our FI department needs to post FI documents by uploading the list of line items. For each line item (even when they have the same g/l account) tax code may be different from 0 to 10%. Also the tax code needs to be entered in EUR not in %. So for example they may need to post the folowing document:
              PstKey   Account    Amount     Tax amt
    001     21          Vendor       95 EUR     Tax amount 5 EUR
    002     50          GRIR          100 EUR
    003     21          Vendor       90 EUR     Tax amount 10 EUR
    004     50          GRIR          100 EUR
    At the moment users have to post it manually. Tax rate cannot be restricted to allow tax from 0 to 10%.
    Can you please advice what would be the best approach for them to make it? Providing they do want to upload the document not enter the items manually..
    Thanks a lot in advance for your help!

    Hi,
    are there some messages during this process? Upload this list in foreground batch input execution. Verify if in stop point displays any messagem. If it is the case, go to OBA5 to change its status.
    Let me know results.
    regards

  • Where can i find info to identify use of symbols on each line of songs list?

    Where can I find info to identify symbols on each line in songs list?

    Take a look at this -> iTunes 11 for Windows: Symbols used in iTunes

  • PP : Need to find Multiple Batches for different production Orders

    Hi Experts,
    I have a requirement that, user wants to see the  "Single batch assigned for multiple production orders and different materials"
    Which its a off case, it cannot be done , but i have gone with 1. So user wants to know all the Orders which has same batch but for different  materials & Orders.
    Please help me in this regard.
    Br,
    SandeepCH

    Hi Shri,
    Please find the attachment  for your better understanding.
    Yes, as you said one material can have multiple batches, But that same batch cannot be linked with other material. This was my requirement.
    So now i want to know all the  batches which came in double for different materials.
    Br,
    SandeepCH

  • How to find multiple instances of buttons

    Hi all.
    I am currently adapting a piece of work from another of our business partners so that it is accurate for our own area of business (yes we are allowed to)
    The creator has placed a certain image button into the product that links to different external web pages.
    This all works well, however, I now need to change the links on these buttons so that the policies that appear are our own and not theirs.
    These buttons are not named in any way other than by their filename (padlock)
    Captivate lists them simply as Button_***
    Is there any way of searching for these buttons so that I don't miss any?
    There are quite a few in this 100 slide project.
    Any help is appreciated,.
    I've tried the Ctrl-F search but it doesn't allow you to narrow it down to a specific button. And I cannot find any usage statistics for buttons in the properties anywhere.
    Regards

    Hi there,
    First way to check the button is from the Timeline, everything which you're using is available in timeline. Please check the screenshot:
    And to change the links in Captivate, just select the button in your project and check the properties panel in the Right side. Check the screenshot.
    Hope this helps.
    Thanks
    Priyank

  • Using indexOf to find multiple instances?

    I have code that will take html code and a tagname (ex. img) and it will return the whole tag (ex. <img src="blabla.jpg">yay</img>). Problem is, I need it to return every instance of that tag. So instead of returning the first instance that it finds of <img>, it returns a String array (i guess) of every instance of an <img>...</img> tag.
    public static String findTag(String html, String tagname){
        return html.substring(html.indexOf("<"+tagname+">"),(html.indexOf("</"+tagname+">") + tagname.length() + 3));
      }

    There is another indexOf method that takes a second int parameter that indicates where to start searching from. Look at the following example and see how you can modify it for your purposes.
    class Indexy {
        public static void main(String[] args) {
            String text = "abcdeabcdabcabcde";
            int location = -1;
            while((location = text.indexOf("a", location + 1)) != -1) {
                System.out.println(location);
    }

  • Weblogic server installation - multiple instances in different ports

    Hi
    I want to install weblogic server(10.0) in my system but it should have three instances running on different ports(equivalent to 3 servers running on the same host). The application hosted on one server will be interacting with the applications hosted on the other two servers.
    Could anybody tell me how to install weblogic server in this way?
    Thanks
    Praveena

    Hi Jakarta,
    As you have mentioned: You want to have three instances running on different ports.
    In that case you can create 3 managed Servers after Creating the WebLogic Domain.
    Step1). Create a Fresh WebLogic Domain.
    Step2). Login to Admin Console (http://localhost:7001/console) and then Create 3 manager Servers and then assign different Ports to them.
    MS1------7003
    MS2------7005
    MS3------7007
    Step3). Start These Servers using <DOMAIN_HOME>/bin/startManagedWebLogic.cmd/sh like:
    startManagedWebLogic.cmd MS1 t3://localhost:7001
    startManagedWebLogic.cmd MS2 t3://localhost:7001
    startManagedWebLogic.cmd MS3 t3://localhost:7001
    Here "localhost:7001" is the Admin Server URL.
    <BR>
    <font color=maroon>
    About The application hosted on one server will be interacting with the applications hosted on the other two servers.</font>
    Here which kind of interaction you are talking about...HTTP interaction, RMI Interaction...With above setup it is possible...
    Do you want any kind of WebLogic Clustering?
    Thanks
    Jay SenSharma
    http://jaysensharma.wordpress.com (WebLogic Wonders Are Here)

  • RSS portlet -- multiple instances w/ different contentURLs?

    The documentation of the RSS sample portlet (http://edocs.bea.com/workshop/docs81/doc/en/core/index.html)
    describes how you can use this portlet in your own portal application. Furthermore,
    it claims that it is possible to use different instances of the RSS portlet with
    different contentURLs. I am unable to figure out how I can set the contentURL
    as an instance property. It appears that it can only be globally changed for the
    entire portlet itself, meaning that all instances of this portlet have the same
    content.
    Any hints appreciated.
    Jan

    i can only assume that it is a portlet preference. you can go in through the admin
    tools and set them or if the portlet hase an 'edit' button they should be editable
    through there for the end user.
    "Jan" <[email protected]> wrote:
    >
    The documentation of the RSS sample portlet (http://edocs.bea.com/workshop/docs81/doc/en/core/index.html)
    describes how you can use this portlet in your own portal application.
    Furthermore,
    it claims that it is possible to use different instances of the RSS portlet
    with
    different contentURLs. I am unable to figure out how I can set the contentURL
    as an instance property. It appears that it can only be globally changed
    for the
    entire portlet itself, meaning that all instances of this portlet have
    the same
    content.
    Any hints appreciated.
    Jan

Maybe you are looking for