-1

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 
5
  • 1
    Can you give an example of input and output. As I can not workout what you are trying to do from the description. Commented Jan 31, 2018 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 Commented Jan 31, 2018 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 :) Commented Jan 31, 2018 at 19:51
  • 1
    @bvl, update your question Commented Jan 31, 2018 at 19:51
  • I do it with tr, but i need to do it with sed. Now I can not change symbols using sed:(. Commented Jan 31, 2018 at 20:22

1 Answer 1

2

This should work:

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.