I have a lot of text files (with .txt extension) in one directory in which I want to convert all letters to uppercase. How can I do this using the terminal?

I've tried:

sed -i 's/[A-Z]/[a-z]/g' *.txt

but without success...

1 Answer 1


The right way using sed should be done with the help of \U switch:

sed -i 's/.*/\U&/' *.txt

See also:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.