0

Hi everyone,

Sorry to be a bother but everything programming seems almost foreign to me.

Im trying to write a shell script (using 'sed' and 'tr' etc.) which replaces a string of text with another. That is the easy part. The part Im stuck with is making it case insensitive.

1. so that case doesnt matter to the trasformation; and
2. then the changed word/letters keeping the same case pattern it had before it was transformed.

Cheers in advance for any help or assisstance u can give me

J.

3
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by sn4rf3r
0

What about simply running the entire string through two tr statements. The first one transforming either the the upper or lower case letters, and the second one transforming the other.

That would be my first suggestion, but it would definately help to see the related snippet of code.

0

you can use regular expressions in sed, this will replace all instances of findthis with replacement

sed -e 's/[fFiInNdDtThHiIsS]/replacement/g'

give an example of a string you are looking for and we can give you an example regex to use.

0

Except for the fact that he said he wants to keep the original case, which that regex would not allow. I am assuming he is doing some sort of alphabet shift to quasi encode or scramble a string (at least that is what it sounds like to me since he wishes to keep the same capitalisation pattern).

0

my bad, missed that part.... like masijade said, i think a code sample or problem text is needed to clarify.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.