tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ replacing space with underscore

How to display a paragraph instead of a line with grep? ▻

Upper and Lower case in SED??

In article <Ox_e3.348$b%3.32333@dummy.bahnhof.se>,
Edison Shadabi  <mittran@metro.bahnhof.se> wrote:
>I would like to know if there is any flag for sed that make sed non-case
>sensitive?

No.

>sed 's/'$var'/foundhere!/'

Your best bet is probably to use Perl.  But if you really need to do it
in sed, here's one way.  (Since you don't say what shell you're using,
I'm assuming rc. :-)

    iccmd = `{ for (i in Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz) echo -e s/[^$i^]/[^$i^]/g }

    newvar = `{ echo $var |sed $iccmd }

    sed s/^$newvar^/foundhere!/g

Tim.
--
Tim Goodwin   | "You don't need to do drugs in order to
University of | think that the government's policies are
Leicester, UK | stupid and dangerous." -- David Bancroft

Original headers:

From: tjg@ltpcg.star.le.ac.uk (Tim J Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: Upper and Lower case in SED??
Date: 2 Jul 1999 12:08:52 +0100
Organization: University of Leicester, UK
Message-ID: <7li6k4$1uu$1@ltpcg.star.le.ac.uk>
References: <Ox_e3.348$b%3.32333@dummy.bahnhof.se>

△ comp.unix.shell △

◅ replacing space with underscore

How to display a paragraph instead of a line with grep? ▻