Need help to change tokenized string case

I'm trying to change the string cases for a particular column, but can't figure how do to it with sed. Example:

Strings (space as delimiter):
write group MYGROUP MySpecialGroup /local/users/mygroup
write group HISGROUP HisSpecialGroup /local/users/hisgroup
write group HerGroup HerSpecialGroup /local/users/hergroup

Desire output:
write group mygroup MySpecialGroup /local/users/mygroup
write group hisgroup HisSpecialGroup /local/users/hisgroup
write group hergroup HerSpecialGroup /local/users/hergroup

I just want to change the string to lower case for 3rd column and rest should be untouch...

Please advise.
Thanks.

try this..

awk '{ $3=tolower($3)}1' file

Awesome pamu, this is exactly what I'm looking for. Thanks! :slight_smile:

I have another question about running this selectively on these lines. Supposed I just want to convert the lower case if the line starts with "write..." but not others. How can I do this in awk? I tried grep, but it will not print those that are not "write...". And I want to print all these lines...

Thanks. :slight_smile:

try this....

awk '/^write/{ $3=tolower($3)}1' file