Help needed please



  • so i have a large txt files and each string is like this
    1000000|0000|0000|abcderfjejeh|
    2000000|0000000|00|uerjrurjejjejej
    And so on…
    now i want to extract only part starting with:
    0000000|0000000|00| without the characters
    how i can do it ?
    thanks in advance.



  • @Francesca-D-Angelo
    numbers and letters are just an example they aint all “0” in the original file text.
    Please help.



  • @Francesca-D-Angelo said in Help needed please:

    i want to extract only part starting with

    It’s a bit difficult as your example doesn’t give much away. But if I read it correctly you have strings of characters which are delimited by the | character. And you want the first 3 sets including that delimiter. So if I’m correct the following regex (regular expression) should work in a Replace function.
    Find What:^([^|]+\|[^|]+\|[^|]+\|).+$
    Replace With:\1
    As this is a regex it needs the search mode set to “regular expression” and please have wrap around ticked.
    To give a bit of background the regex says:
    [^|]+\| take as many characters so long as they are NOT the |, followed by 1 |. Then we do 3 sets of these and as they are inside of the () we save these as group 1. The rest of the line is also captured but as it is not inside brackets it is not saved. Only group 1 is written back. The result should be what you need.

    If you find it does not meet your needs please come back with more info, especially examples. Real data is best, or at least good example data, rather then just the 0's you provided.

    Terry



  • @Terry-R you did it !!! it worked you saved me days of work i was extracting 1 by 1 ;*
    now last thing if it is possible
    now i have
    "1|0000000|000|00000
    "2|0000000|00000|00000
    and so on…

    i want remove the "1 , "2, "3, and so on…

    thats last thing! thank you a lot



  • @Francesca-D-Angelo

    @Terry-R said in Help needed please:

    @Francesca-D-Angelo said in Help needed please:

    i want to extract only part starting with

    It’s a bit difficult as your example doesn’t give much away. But if I read it correctly you have strings of characters which are delimited by the | character. And you want the first 3 sets including that delimiter. So if I’m correct the following regex (regular expression) should work in a Replace function.
    Find What:^([^|]+\|[^|]+\|[^|]+\|).+$
    Replace With:\1
    As this is a regex it needs the search mode set to “regular expression” and please have wrap around ticked.
    To give a bit of background the regex says:
    [^|]+\| take as many characters so long as they are NOT the |, followed by 1 |. Then we do 3 sets of these and as they are inside of the () we save these as group 1. The rest of the line is also captured but as it is not inside brackets it is not saved. Only group 1 is written back. The result should be what you need.

    If you find it does not meet your needs please come back with more info, especially examples. Real data is best, or at least good example data, rather then just the 0's you provided.

    Terry

    now i need remove the
    "1|
    "2|
    "3|
    and so on…
    from the results
    "1|00000000|0000|000
    clean result should be:
    00000000|0000|000

    hope you have understood and sorry for double post.



  • @Francesca-D-Angelo said in Help needed please:

    now i need remove the
    "1|
    "2|
    "3|

    How about trying (in the Replace function)
    Find What:^"[^|]+\|
    Replace With: nothing in this field, make sure it is empty

    This time it’s looking for the " character at the start of a line followed by as many characters as possible ending in the first delimiter |.

    A proviso here, the quote you typed may NOT be the same as finally presented because the window you type the post in is processed before it appears in the forum. The quote character is one of the more common characters changed by the system. So if it doesn’t work replace my quote with the quote you actually have in your data.

    Preferably for any further posts use the </> button which you see immediately above the window in which you type. Enter the text, select the text and then use this button which encapsulates the text in the black box. This will prevent characters from being possibly altered, which is especially important for any examples you provide.

    If you need any further help you MUST use this black box to provide the examples otherwise I won’t be helping.

    Terry

    PS it’s also nice to receive "upvotes. which you see below each post on the right side. It starts at 0. Use the arrow keys either side for upvote or downvote.



  • thanks a lot this worked too.
    I promise this will be last request:

    now if in some case i have:

    1|0000|00000|000
    2|0000|0000000|0000 
    10|
    100|
    and so on
    

    so without the " at the beginning, what command i should use for remove them?



  • @Francesca-D-Angelo said in Help needed please:

    without the " at the beginning

    First off, thanks for reading and doing as requested. It makes it so much easier if the examples can be trusted.

    Try my previous solution and just remove the ". That should be sufficient although I do note some of the examples don’t have 3 sets. Your data seems a bit arbitrary as generally delimited data will always have the same number of fields

    Terry


Log in to reply