Sed. Change the characters in a string that satisfying a pattern [duplicate]
Clash 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
linux sed
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.
add a comment |Â
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
linux sed
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
add a comment |Â
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
linux sed
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
linux sed
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
add a comment |Â
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
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
This should work:
sed '/name/y/abcdefghijklmnopqrstuvwxyz/bcdefghijklmnopqrstuvwxyza/' infile
add a comment |Â
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
add a comment |Â
up vote
2
down vote
This should work:
sed '/name/y/abcdefghijklmnopqrstuvwxyz/bcdefghijklmnopqrstuvwxyza/' infile
add a comment |Â
up vote
2
down vote
up vote
2
down vote
This should work:
sed '/name/y/abcdefghijklmnopqrstuvwxyz/bcdefghijklmnopqrstuvwxyza/' infile
This should work:
sed '/name/y/abcdefghijklmnopqrstuvwxyz/bcdefghijklmnopqrstuvwxyza/' infile
answered Jan 31 at 21:48
Isaac
6,6371734
6,6371734
add a comment |Â
add a comment |Â
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