Unix tr command to convert lower case to upper AND upper to lower case
问题 So I was searching around and using the command tr you can convert from lower case to upper case and vice versa. But is there a way to do this both at once? So: $ tr '[:upper:]' '[:lower:]' or $ tr A-Z a-z will turn: "Hello World ABC" to "hello world abc" but I want it to do: "hELLO wORLD abc" Please help! =) 回答1: This will do what you are looking for: tr '[:upper:][:lower:]' '[:lower:][:upper:]' 回答2: I think tr '[a-zA-Z]' '[A-Za-z]' is more straight forward, and easier to remember. 回答3: You