2

So I'm wanting to find out what the command line would look like to copy the text contained in a file, convert the whole thing to upper-case and paste that into a new file with a given name.

I'm very new to Linux so I've been running through a few lists of commands and existing questions but I couldn't find anything which answered this.

Thanks

1 Answer 1

5

The following command can do that

tr '[:lower:]' '[:upper:]' < input.txt > output.txt
6
  • Thanks, just to check my understanding... if i had File1 and I wanted to create a new file called File2 with the translated text in it I would write: tr '[:lower:]' '[:upper:]' < File1 > File2 ? Apr 23, 2019 at 15:27
  • yes it will translate all the text in file1 and create a file file2 with upper case converted text of the file1. Apr 23, 2019 at 15:39
  • @True_False_AX10M Isn't your command identical to the answer, except for the filenames?
    – Barmar
    Apr 23, 2019 at 19:21
  • @Barmar yes it is. I just wanted to ensure I was understanding the formatting correctly and that the input output bits I would simply replace with the file names. Apr 24, 2019 at 7:02
  • @aviral dobhal I tried this and it didn't work for some reason. I've checked the formatting to make sure I typed it all correctly but it didn't create the new file. I tried creating the file first then running it but the new file is empty. The files were created using touch NewFile so they are not .txt files. Do you know if this would cause the problem? Thanks. Apr 24, 2019 at 20:17

You must log in to answer this question.

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