1

I downloaded a text dump. It has the extension .v2.gz. Using gzip on the .v2.gz file shows me text. I have used gunzip to uncompress the file with .v2 format. How can I save it as .txt because the program which I need to run will only accept UTF-8 encoded .txt file.

  • what's the output of file name-of-your-file.v2 ? (replace with your secret name obviously) – Zanna Sep 05 '16 at 14:19
  • @Zanna The output is UTF-8 Unicode text, with very long lines –  Sep 05 '16 at 14:21
  • in that case you don't need to do anything at all. If the filename really needs an extension, then rename it - the file format is correct – Zanna Sep 05 '16 at 14:23
  • you dont need an extension for text files , thats for windows users not for us we dont need extensions all the time. – hellozee Sep 05 '16 at 14:26
  • heh any time! I wrote an answer for you with more explanation :) – Zanna Sep 05 '16 at 14:43

1 Answers1

4

The extension probably does not matter. While some applications use or are able to use filename extensions in Ubuntu (and Linux systems generally) to identify file formats, most of the time, other methods are used to determine file type (checking for a magic number or header in the first few bytes of the file is the typical way).

You can read discussion of this in glorious detail in this question.

Since you checked the format of the file with the file command and found that it is already UTF-8 text, the .v2 extension must be arbitrary and you probably don't need to do anything at all. However, I don't know what program you are using, so in the case that it really requires that extension, rename the file, for example with the mv command:

mv file.v2 file.txt
Zanna
  • 70,465