For Programmers: Free Programming Magazines  


Home > Archive > AWK > April 2007 > Replace text









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Replace text
SamG

2007-04-19, 9:56 pm

How do i replace text in a file with some text passed into a variable
say

$var in my script using awk. Assuming this text is fairly huge. About
1000 characters

Janis Papanagnou

2007-04-19, 9:56 pm

SamG wrote:
> How do i replace text in a file with some text passed into a variable
> say


Would you mind making your question clearer; an example also helps
to make clear what you want.

To replace text in a data stream use awk's sub (or gsub) function;
and the substitution string may be provided using an awk variable.

Janis

>
> $var in my script using awk. Assuming this text is fairly huge. About
> 1000 characters
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com