$ cat < test.in one o n e two t w o three t h r e e EOF $ perl -pe 's/(\w+)/\U$1/' < test.in > test.out $ cat test.out ONE o n e TWO t w o THREE t h r e e