I am wondering if there is a simple way using sed or awk to replace a string in a specific column and in multiple lines with another string. The string repeats in other columns but I would like the string in a specific column to be replaced while preserving the inconsistent number of white spaces between columns. For example, I'm hoping to replace 'A' in column 3, lines 2-4 to 'B', while preserving the same whitespaces between columns.
1 2 A 4 A B C A E F G 7 8 9
2 11 A 4 A B C A E F G 7 8 9
3 12 A 4 A B C A E F G 7 8 9
4 13 A 4 A B C A E F G 7 8 9
5 14 A 4 A B C A E F G 7 8 9
6 15 A 4 A B C A E F G 7 8 9
.
.
to
1 2 A 4 A B C A E F G 7 8 9
2 11 B 4 A B C A E F G 7 8 9
3 12 B 4 A B C A E F G 7 8 9
4 13 B 4 A B C A E F G 7 8 9
5 14 A 4 A B C A E F G 7 8 9
6 15 A 4 A B C A E F G 7 8 9
.
.
Thanks!