Clear certain area



  • Hello together, I have two strings in a file, there are only the letters and special characters to be deleted. The phone number must stop.

    *The bold can be deleted.

    =================================================
    Policy

    1 MB 491609xxxxxx Mustermann , Musterstraße Nr.34
    1029
    8
    1 MB 491609xxxxxx Mustermann , Musterstraße Nr.34
    1029
    4
    MATCH(“Calling-Station-Id=491609xxxxxx”)
    1029
    2
    125

    4546
    3
    4
    3
    3
    5
    10
    3
    9
    3
    7

    8
    3
    -1408154491

    7
    5
    2

    6
    3
    5

    How do I get the phone number and only the brads are deleted.

    Many Thanks
    greeting
    Michael



  • @Mic-Hael

    don’t really get this.

    The phone number must stop.

    Maybe the phone number must stay (should not be deleted)?
    So from

    =================================================
    Policy

    1 MB 491609xxxxxx Mustermann , Musterstraße Nr.34
    1029
    8
    1 MB 491609xxxxxx Mustermann , Musterstraße Nr.34
    1029
    4

    to

    =================================================
    Policy

    491609xxxxxx
    1029
    8
    491609xxxxxx
    1029
    4

    ??

    Does the number always start with german country code and mobile 160 area code?
    If so, this could be used to create a regex something like

    find: ^.*(49160\d+).*$
    replace: \1
    

    Cheers
    Claudia



  • Hello Claudia,
    the call number must stand still and the text may only be changed in the 2 marked lines.
    MATCH (“Calling-Station-Id = 491609xxxxxx”) must not be changed in any case !!!

    Thanks
    greeting
    Michael



  • @Mic-Hael

    so something like

    if not Calling-Station-Id= before mobile number than replace?
    Is it always like that?

    Cheers
    Claudia



  • @Claudia-Frank

    or if there is always a space after the number but not in the case with the calling-station you could do

    find: ^.*(49160\d+)\s.*$
    replace: \1

Log in to reply