Announcement

Collapse
No announcement yet.

Convert a file to all uppercase using sed

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Convert a file to all uppercase using sed

    Hi there,

    I have a file I that I want to change all text within to uppercase. I would like to learn this using sed.

    I was thinking

    sed 's/[a-z]/[A-Z]/g' might be my answer, but it doesn't seem to work. Any ideas guys?

    #2
    Re: Convert a file to all uppercase using sed

    Code:
    tr '[:lower:]' '[:upper:]' < input.txt > output.txt
    Works like a champ. 8)

    Reference: man tr
    Windows no longer obstructs my view.
    Using Kubuntu Linux since March 23, 2007.
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      Re: Convert a file to all uppercase using sed

      ...and with the sed > Sed - An Introduction and Tutorial

      Transform with y

      If you wanted to change a word from lower case to upper case, you could write 26 character substitutions, converting "a" to "A," etc. Sed has a command that operates like the tr program. It is called the "y" command. For instance, to change the letters "a" through "f" into their upper case form, use:
      sed 'y/abcdef/ABCDEF/' file

      I could have used an example that converted all 26 letters into upper case

      and even more > UPPERCASE to lowercase command?
      Before you edit, BACKUP !

      Why there are dead links ?
      1. Thread: Please explain how to access old kubuntu forum posts
      2. Thread: Lost Information

      Comment

      Working...
      X