Sed. Change the characters in a string that satisfying a pattern [duplicate]

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











up vote
-1
down vote

favorite













This question already has an answer here:



  • How do I replace characters only on certain lines?

    3 answers



I have a file with these lines:



abcd hfd ktr
hfk itor fld
fjkdf name fkld
ew wew name


It is necessary to change the characters in the lines that satisfy the pattern (contain the word 'name') as follows: a-> b, b-> c, c-> d ... z-> a, and apply these changes to the file. resulting in:



abcd hfd ktr
hfk itor fld
gkleg obnf glmf
fx xfx obnf






share|improve this question














marked as duplicate by don_crissti, dhag, maulinglawns, RomanPerekhrest, roaima Jan 31 at 23:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    Can you give an example of input and output. As I can not workout what you are trying to do from the description.
    – ctrl-alt-delor
    Jan 31 at 19:48










  • Before: abcd hfd ktr hfk itor fld fjkdf name fkld ew wew name After: abcd hfd ktr hfk itor fld gkleg obnf glmf fx xfx obnf
    – bvl
    Jan 31 at 19:50











  • do you want to use/code of any char to char+n value ?? if so sed will be harder to use than awk or bash :)
    – francois P
    Jan 31 at 19:51






  • 1




    @bvl, update your question
    – RomanPerekhrest
    Jan 31 at 19:51










  • I do it with tr, but i need to do it with sed. Now I can not change symbols using sed:(.
    – bvl
    Jan 31 at 20:22














up vote
-1
down vote

favorite













This question already has an answer here:



  • How do I replace characters only on certain lines?

    3 answers



I have a file with these lines:



abcd hfd ktr
hfk itor fld
fjkdf name fkld
ew wew name


It is necessary to change the characters in the lines that satisfy the pattern (contain the word 'name') as follows: a-> b, b-> c, c-> d ... z-> a, and apply these changes to the file. resulting in:



abcd hfd ktr
hfk itor fld
gkleg obnf glmf
fx xfx obnf






share|improve this question














marked as duplicate by don_crissti, dhag, maulinglawns, RomanPerekhrest, roaima Jan 31 at 23:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    Can you give an example of input and output. As I can not workout what you are trying to do from the description.
    – ctrl-alt-delor
    Jan 31 at 19:48










  • Before: abcd hfd ktr hfk itor fld fjkdf name fkld ew wew name After: abcd hfd ktr hfk itor fld gkleg obnf glmf fx xfx obnf
    – bvl
    Jan 31 at 19:50











  • do you want to use/code of any char to char+n value ?? if so sed will be harder to use than awk or bash :)
    – francois P
    Jan 31 at 19:51






  • 1




    @bvl, update your question
    – RomanPerekhrest
    Jan 31 at 19:51










  • I do it with tr, but i need to do it with sed. Now I can not change symbols using sed:(.
    – bvl
    Jan 31 at 20:22












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite












This question already has an answer here:



  • How do I replace characters only on certain lines?

    3 answers



I have a file with these lines:



abcd hfd ktr
hfk itor fld
fjkdf name fkld
ew wew name


It is necessary to change the characters in the lines that satisfy the pattern (contain the word 'name') as follows: a-> b, b-> c, c-> d ... z-> a, and apply these changes to the file. resulting in:



abcd hfd ktr
hfk itor fld
gkleg obnf glmf
fx xfx obnf






share|improve this question















This question already has an answer here:



  • How do I replace characters only on certain lines?

    3 answers



I have a file with these lines:



abcd hfd ktr
hfk itor fld
fjkdf name fkld
ew wew name


It is necessary to change the characters in the lines that satisfy the pattern (contain the word 'name') as follows: a-> b, b-> c, c-> d ... z-> a, and apply these changes to the file. resulting in:



abcd hfd ktr
hfk itor fld
gkleg obnf glmf
fx xfx obnf




This question already has an answer here:



  • How do I replace characters only on certain lines?

    3 answers









share|improve this question













share|improve this question




share|improve this question








edited Jan 31 at 21:43









Isaac

6,6371734




6,6371734










asked Jan 31 at 19:42









bvl

1




1




marked as duplicate by don_crissti, dhag, maulinglawns, RomanPerekhrest, roaima Jan 31 at 23:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by don_crissti, dhag, maulinglawns, RomanPerekhrest, roaima Jan 31 at 23:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1




    Can you give an example of input and output. As I can not workout what you are trying to do from the description.
    – ctrl-alt-delor
    Jan 31 at 19:48










  • Before: abcd hfd ktr hfk itor fld fjkdf name fkld ew wew name After: abcd hfd ktr hfk itor fld gkleg obnf glmf fx xfx obnf
    – bvl
    Jan 31 at 19:50











  • do you want to use/code of any char to char+n value ?? if so sed will be harder to use than awk or bash :)
    – francois P
    Jan 31 at 19:51






  • 1




    @bvl, update your question
    – RomanPerekhrest
    Jan 31 at 19:51










  • I do it with tr, but i need to do it with sed. Now I can not change symbols using sed:(.
    – bvl
    Jan 31 at 20:22












  • 1




    Can you give an example of input and output. As I can not workout what you are trying to do from the description.
    – ctrl-alt-delor
    Jan 31 at 19:48










  • Before: abcd hfd ktr hfk itor fld fjkdf name fkld ew wew name After: abcd hfd ktr hfk itor fld gkleg obnf glmf fx xfx obnf
    – bvl
    Jan 31 at 19:50











  • do you want to use/code of any char to char+n value ?? if so sed will be harder to use than awk or bash :)
    – francois P
    Jan 31 at 19:51






  • 1




    @bvl, update your question
    – RomanPerekhrest
    Jan 31 at 19:51










  • I do it with tr, but i need to do it with sed. Now I can not change symbols using sed:(.
    – bvl
    Jan 31 at 20:22







1




1




Can you give an example of input and output. As I can not workout what you are trying to do from the description.
– ctrl-alt-delor
Jan 31 at 19:48




Can you give an example of input and output. As I can not workout what you are trying to do from the description.
– ctrl-alt-delor
Jan 31 at 19:48












Before: abcd hfd ktr hfk itor fld fjkdf name fkld ew wew name After: abcd hfd ktr hfk itor fld gkleg obnf glmf fx xfx obnf
– bvl
Jan 31 at 19:50





Before: abcd hfd ktr hfk itor fld fjkdf name fkld ew wew name After: abcd hfd ktr hfk itor fld gkleg obnf glmf fx xfx obnf
– bvl
Jan 31 at 19:50













do you want to use/code of any char to char+n value ?? if so sed will be harder to use than awk or bash :)
– francois P
Jan 31 at 19:51




do you want to use/code of any char to char+n value ?? if so sed will be harder to use than awk or bash :)
– francois P
Jan 31 at 19:51




1




1




@bvl, update your question
– RomanPerekhrest
Jan 31 at 19:51




@bvl, update your question
– RomanPerekhrest
Jan 31 at 19:51












I do it with tr, but i need to do it with sed. Now I can not change symbols using sed:(.
– bvl
Jan 31 at 20:22




I do it with tr, but i need to do it with sed. Now I can not change symbols using sed:(.
– bvl
Jan 31 at 20:22










1 Answer
1






active

oldest

votes

















up vote
2
down vote













This should work:



sed '/name/y/abcdefghijklmnopqrstuvwxyz/bcdefghijklmnopqrstuvwxyza/' infile





share|improve this answer



























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote













    This should work:



    sed '/name/y/abcdefghijklmnopqrstuvwxyz/bcdefghijklmnopqrstuvwxyza/' infile





    share|improve this answer
























      up vote
      2
      down vote













      This should work:



      sed '/name/y/abcdefghijklmnopqrstuvwxyz/bcdefghijklmnopqrstuvwxyza/' infile





      share|improve this answer






















        up vote
        2
        down vote










        up vote
        2
        down vote









        This should work:



        sed '/name/y/abcdefghijklmnopqrstuvwxyz/bcdefghijklmnopqrstuvwxyza/' infile





        share|improve this answer












        This should work:



        sed '/name/y/abcdefghijklmnopqrstuvwxyz/bcdefghijklmnopqrstuvwxyza/' infile






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 31 at 21:48









        Isaac

        6,6371734




        6,6371734












            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