On Mon, Dec 3, 2012 at 3:37 AM, j. v. d. hoff <[email protected]>wrote:
> hi,
>
> I'm currently trying to set up a `ksh' script as a drop in replacement for
> `awk' in processing some text. I've stumbled over the following.
> consider this string:
>
> a="water: h~2~^o^ and ammonia: NH~3~"
>
> where I want to replace the `~' enclosed text parts by something else,
> maintaining the enclosed text. I've tried
>
> echo "${a/~(-g:~(*)~)/#\1#}"
>
> to replace the first hit in the line by `h#2#'
>
> but this does not work (neither does the same with backquoted `~').
>
> what am I missing? something to do with tilde expansion?
>
[STEP 100] $ echo ${.sh.version}
Version AJMP 93u+ 2012-08-01
[STEP 101] $ a="water: h~2~^o^ and ammonia: NH~3~"
[STEP 102] $ echo "${a/@-(~@(*)~)/#\2#}"
water: h#2#^o^ and ammonia: NH~3~
[STEP 103] $ echo "${a//@-(~@(*)~)/#\2#}"
water: h#2#^o^ and ammonia: NH#3#
[STEP 104] $
>
> thanks
> joerg
> --
> Using Opera's revolutionary email client: http://www.opera.com/mail/
> ______________________________**_________________
> ast-users mailing list
> [email protected].**com <[email protected]>
> http://lists.research.att.com/**mailman/listinfo/ast-users<http://lists.research.att.com/mailman/listinfo/ast-users>
>
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users