Re: changing string occurencies in a line up to a delimiter

From: Dana French (dfrench_at_mtxia.com)
Date: 09/09/04


Date: 8 Sep 2004 15:53:50 -0700

Stephane CHAZELAS <this.address@is.invalid> wrote in message news:<slrncju9ip.1i0.stephane.chazelas@spam.is.invalid>...
> 2004-09-8, 08:09(-07), Dana French:
> [...]
> > A ksh93 solution:
> >
> > #!/usr/bin/ksh93
> > while IFS='@' read -r -- PART1 PART2
> > do
> > RESULT="${PART2:+${PART1//<[Bb][Rr]>/}@${PART2}}"
> > print "${RESULT:-${PART1//<[Bb][Rr]>/}}"
> > done < file.in
> [...]
>
> For a file like:
>
> <<
> @@@
> A<br>B@
> -n
> A\nB
> >>
>
> it gives:
>
> <<
> @@@
> AB
> A
> B
> >>

The file contents you suggest in your post were not indicated by the
OP. The ksh93 solution I provided solved the question that was asked.

--------------------------------------------------------
Dana French dfrench@mtxia.com
Mt Xia Technical Consulting Group http://www.mtxia.com
100% Spam Free Email http://www.ridmail.com
MicroEmacs http://uemacs.tripod.com
Korn Shell Web http://dfrench.tripod.com/kshweb.html



Relevant Pages

  • Re: sed: how to replace a c variable?
    ... A ksh93 solution: ... Mt Xia Technical Consulting Group http://www.mtxia.com ... Korn Shell Web http://dfrench.tripod.com/kshweb.html ...
    (comp.unix.shell)
  • Re: Moving multiple files with certain line counts
    ... > SINGAPORE ... Mt Xia Technical Consulting Group http://www.mtxia.com ... Korn Shell Web http://dfrench.tripod.com/kshweb.html ...
    (comp.unix.shell)
  • Re: Help needed with files renaming
    ... typeset -Z2 NUM ... Mt Xia Technical Consulting Group http://www.mtxia.com ... Korn Shell Web http://dfrench.tripod.com/kshweb.html ...
    (comp.unix.shell)
  • Re: change <blablabla /> to <!-- blablabla -->
    ... > I have a web.config file for .net application which I want to do some editing. ... Mt Xia Technical Consulting Group http://www.mtxia.com ... Korn Shell Web http://dfrench.tripod.com/kshweb.html ...
    (comp.unix.shell)
  • Re: Howto increment an ASCII character
    ... > so that I can now construct 'sde' ... Mt Xia Technical Consulting Group http://www.mtxia.com ... Korn Shell Web http://dfrench.tripod.com/kshweb.html ...
    (comp.unix.shell)

Loading