Removing caret sign and adding parentheses to pager numbers

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I have strings like these



NE234GJKLKU,*9^789098
NE345HJsdfe,*1^534656
YBKJNJKHBKK,*1^987654
UTGHNKOIUYO,*1^123421
ERTYUIJHGLK,*1^456666


that I wish to be:



NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666


Any suggestions?










share|improve this question









New contributor




Cumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Sorry, should be correct now!
    – Cumar
    36 mins ago














up vote
2
down vote

favorite












I have strings like these



NE234GJKLKU,*9^789098
NE345HJsdfe,*1^534656
YBKJNJKHBKK,*1^987654
UTGHNKOIUYO,*1^123421
ERTYUIJHGLK,*1^456666


that I wish to be:



NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666


Any suggestions?










share|improve this question









New contributor




Cumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Sorry, should be correct now!
    – Cumar
    36 mins ago












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have strings like these



NE234GJKLKU,*9^789098
NE345HJsdfe,*1^534656
YBKJNJKHBKK,*1^987654
UTGHNKOIUYO,*1^123421
ERTYUIJHGLK,*1^456666


that I wish to be:



NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666


Any suggestions?










share|improve this question









New contributor




Cumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have strings like these



NE234GJKLKU,*9^789098
NE345HJsdfe,*1^534656
YBKJNJKHBKK,*1^987654
UTGHNKOIUYO,*1^123421
ERTYUIJHGLK,*1^456666


that I wish to be:



NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666


Any suggestions?







text-processing






share|improve this question









New contributor




Cumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Cumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 29 mins ago









Arkadiusz Drabczyk

7,40521633




7,40521633






New contributor




Cumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 43 mins ago









Cumar

133




133




New contributor




Cumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Cumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Cumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • Sorry, should be correct now!
    – Cumar
    36 mins ago
















  • Sorry, should be correct now!
    – Cumar
    36 mins ago















Sorry, should be correct now!
– Cumar
36 mins ago




Sorry, should be correct now!
– Cumar
36 mins ago










2 Answers
2






active

oldest

votes

















up vote
3
down vote



accepted










try sed



sed -r -e 's/^//g;s/^.13/&(/;s/^.17/&)-/' file

NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666





share|improve this answer




















  • thank you for helping me
    – Cumar
    35 mins ago

















up vote
0
down vote













Another sed solution:



$ sed 's,*,*(,g' FILE | sed -E 's,([0-9])^([b0-9])([0-9]),123)-,g'
NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666


Single line:



$ sed -E 's,*,*(,g;s,([0-9])^([b0-9])([0-9]),123)-,g' FILE
NE234GJKLKU,*(978)-9098
NE345HJsdfe,*(153)-4656
YBKJNJKHBKK,*(198)-7654
UTGHNKOIUYO,*(112)-3421
ERTYUIJHGLK,*(145)-6666





share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Cumar is a new contributor. Be nice, and check out our Code of Conduct.









     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474640%2fremoving-caret-sign-and-adding-parentheses-to-pager-numbers%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote



    accepted










    try sed



    sed -r -e 's/^//g;s/^.13/&(/;s/^.17/&)-/' file

    NE234GJKLKU,*(978)-9098
    NE345HJsdfe,*(153)-4656
    YBKJNJKHBKK,*(198)-7654
    UTGHNKOIUYO,*(112)-3421
    ERTYUIJHGLK,*(145)-6666





    share|improve this answer




















    • thank you for helping me
      – Cumar
      35 mins ago














    up vote
    3
    down vote



    accepted










    try sed



    sed -r -e 's/^//g;s/^.13/&(/;s/^.17/&)-/' file

    NE234GJKLKU,*(978)-9098
    NE345HJsdfe,*(153)-4656
    YBKJNJKHBKK,*(198)-7654
    UTGHNKOIUYO,*(112)-3421
    ERTYUIJHGLK,*(145)-6666





    share|improve this answer




















    • thank you for helping me
      – Cumar
      35 mins ago












    up vote
    3
    down vote



    accepted







    up vote
    3
    down vote



    accepted






    try sed



    sed -r -e 's/^//g;s/^.13/&(/;s/^.17/&)-/' file

    NE234GJKLKU,*(978)-9098
    NE345HJsdfe,*(153)-4656
    YBKJNJKHBKK,*(198)-7654
    UTGHNKOIUYO,*(112)-3421
    ERTYUIJHGLK,*(145)-6666





    share|improve this answer












    try sed



    sed -r -e 's/^//g;s/^.13/&(/;s/^.17/&)-/' file

    NE234GJKLKU,*(978)-9098
    NE345HJsdfe,*(153)-4656
    YBKJNJKHBKK,*(198)-7654
    UTGHNKOIUYO,*(112)-3421
    ERTYUIJHGLK,*(145)-6666






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 42 mins ago









    Goro

    8,25854282




    8,25854282











    • thank you for helping me
      – Cumar
      35 mins ago
















    • thank you for helping me
      – Cumar
      35 mins ago















    thank you for helping me
    – Cumar
    35 mins ago




    thank you for helping me
    – Cumar
    35 mins ago












    up vote
    0
    down vote













    Another sed solution:



    $ sed 's,*,*(,g' FILE | sed -E 's,([0-9])^([b0-9])([0-9]),123)-,g'
    NE234GJKLKU,*(978)-9098
    NE345HJsdfe,*(153)-4656
    YBKJNJKHBKK,*(198)-7654
    UTGHNKOIUYO,*(112)-3421
    ERTYUIJHGLK,*(145)-6666


    Single line:



    $ sed -E 's,*,*(,g;s,([0-9])^([b0-9])([0-9]),123)-,g' FILE
    NE234GJKLKU,*(978)-9098
    NE345HJsdfe,*(153)-4656
    YBKJNJKHBKK,*(198)-7654
    UTGHNKOIUYO,*(112)-3421
    ERTYUIJHGLK,*(145)-6666





    share|improve this answer
























      up vote
      0
      down vote













      Another sed solution:



      $ sed 's,*,*(,g' FILE | sed -E 's,([0-9])^([b0-9])([0-9]),123)-,g'
      NE234GJKLKU,*(978)-9098
      NE345HJsdfe,*(153)-4656
      YBKJNJKHBKK,*(198)-7654
      UTGHNKOIUYO,*(112)-3421
      ERTYUIJHGLK,*(145)-6666


      Single line:



      $ sed -E 's,*,*(,g;s,([0-9])^([b0-9])([0-9]),123)-,g' FILE
      NE234GJKLKU,*(978)-9098
      NE345HJsdfe,*(153)-4656
      YBKJNJKHBKK,*(198)-7654
      UTGHNKOIUYO,*(112)-3421
      ERTYUIJHGLK,*(145)-6666





      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        Another sed solution:



        $ sed 's,*,*(,g' FILE | sed -E 's,([0-9])^([b0-9])([0-9]),123)-,g'
        NE234GJKLKU,*(978)-9098
        NE345HJsdfe,*(153)-4656
        YBKJNJKHBKK,*(198)-7654
        UTGHNKOIUYO,*(112)-3421
        ERTYUIJHGLK,*(145)-6666


        Single line:



        $ sed -E 's,*,*(,g;s,([0-9])^([b0-9])([0-9]),123)-,g' FILE
        NE234GJKLKU,*(978)-9098
        NE345HJsdfe,*(153)-4656
        YBKJNJKHBKK,*(198)-7654
        UTGHNKOIUYO,*(112)-3421
        ERTYUIJHGLK,*(145)-6666





        share|improve this answer












        Another sed solution:



        $ sed 's,*,*(,g' FILE | sed -E 's,([0-9])^([b0-9])([0-9]),123)-,g'
        NE234GJKLKU,*(978)-9098
        NE345HJsdfe,*(153)-4656
        YBKJNJKHBKK,*(198)-7654
        UTGHNKOIUYO,*(112)-3421
        ERTYUIJHGLK,*(145)-6666


        Single line:



        $ sed -E 's,*,*(,g;s,([0-9])^([b0-9])([0-9]),123)-,g' FILE
        NE234GJKLKU,*(978)-9098
        NE345HJsdfe,*(153)-4656
        YBKJNJKHBKK,*(198)-7654
        UTGHNKOIUYO,*(112)-3421
        ERTYUIJHGLK,*(145)-6666






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 30 mins ago









        Arkadiusz Drabczyk

        7,40521633




        7,40521633




















            Cumar is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            Cumar is a new contributor. Be nice, and check out our Code of Conduct.












            Cumar is a new contributor. Be nice, and check out our Code of Conduct.











            Cumar is a new contributor. Be nice, and check out our Code of Conduct.













             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474640%2fremoving-caret-sign-and-adding-parentheses-to-pager-numbers%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay