[BASH][SED] Find pattern and replace it's [pattern's] last character
by czezz from LinuxQuestions.org on (#598VV)
Hi all,
Can anyone please give me a little help with sed here?
I have following example file:
Code:cat test
blablalb A i B. E. lalalalal.
A. tralala,la A Bi C.
B. elellfdew A. fww.
C. DiDweofjoie zalamki T.Following grep will highlight the pattern that Im trying to change:
Code:cat test | grep " i [A-Z][.]" (mind the SPACE before "i")So, eventually what Im trying to get is:
Code:blablalb A i B, E. lalalalal.
A. tralala,la A B i C,
B. elellfdew A. fww.
C. DiDweofjoie zalamki T.Normaly, if there was no pattern I would go for someting like this:
Code:sed -e 's/ i [A-Z][.]/ i [A-Z][,]/g' test
sed -e '/ i [A-Z][.]/s//,/' testAny ideas how to get it?


Can anyone please give me a little help with sed here?
I have following example file:
Code:cat test
blablalb A i B. E. lalalalal.
A. tralala,la A Bi C.
B. elellfdew A. fww.
C. DiDweofjoie zalamki T.Following grep will highlight the pattern that Im trying to change:
Code:cat test | grep " i [A-Z][.]" (mind the SPACE before "i")So, eventually what Im trying to get is:
Code:blablalb A i B, E. lalalalal.
A. tralala,la A B i C,
B. elellfdew A. fww.
C. DiDweofjoie zalamki T.Normaly, if there was no pattern I would go for someting like this:
Code:sed -e 's/ i [A-Z][.]/ i [A-Z][,]/g' test
sed -e '/ i [A-Z][.]/s//,/' testAny ideas how to get it?