edit entire column from a fixed-width file using awk or sed

Col1 Col2 Col3 Col4

12     Completed        08       0830
12     In Progress       09       0829
11     For F U            07       0828

Considering the file above, how could i replace the third column the most efficient way? The actual file size is almost 1G. I am having problems with awk since there are spaces between Col 2 and awk is treatng the next word as another column.

Please help!!!

sed is usually faster than awk

Thanks for the reply but I dont know the specific command that will work in this scenario. Would you know how to do that?

An example with awk to replace the 3th column with 01:

awk -v var="01" '{$(NF-1) = var}1' file

Regards

Thank you for that but what if the 4th column are strings with spaces in between? Is there a way to dictate awk to start looking at a certain point like looking at every 200th character of each line?

Hi,

In that case its better to use sed ..

eg:
sed 's/./&replace/200' filename

above command will start replace from 200th character...from the inputfile.

Thanks
SHa

Thanks that's helpful, just wondering if i need to replace only the 200th-220th character of each line, what would the command look like?

Hi,

sed 's/./replacepattern/200' filename

Thanks
SHa

So if the replacement pattern is 20 characters long, it would only overwrite 200-220 charcter?

It will overwrite only the one character...(200th)..
other 19 characters will be inserted..

eg:
$ echo "Hai"|sed 's/./--/1'
--ai

Thanks
SHa

Thanks Shahul! Sorry for the repeated reply... i dont have an available environment as of he moment to test it. I really appreciate your help on this.