Joel Reicher <joel@[EMAIL PROTECTED]
> writes:
> s = sprintf("%s%s%s", substr(s, 1, pos-1), insert, substr(s,
pos+length(insert)))
>
> And in your example, s="123456789", pos=3, and insert="abc".
Sorry, I just realised that's more C-like than it needs to be. A more
awkish expression would probably be
s = substr(s, 1, pos-1) insert substr(s, pos+length(insert))
In other words, string concatenation is native in awk and there's no
need to use sprintf() the way I did originally.
Cheers,
- Joel


|