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.

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.

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.

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).

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.