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:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .