0

When I try to compress the directory into a .tar format it creates successfully, but the tar files contains extra lines(Header/Metadata). I have .csv file in a folder and i need to convert that folder into tar without adding extra lines in the files.

Original csv file

after converted into tar

  • 2
    The question is unclear: What is “su”? What meta data do you not wont? – ctrl-alt-delor May 2 at 11:25
  • 1
    (1) tar does not compress. (2) Why on Earth would you want to cat a tar archive? – AlexP May 2 at 12:36
1

I think there is some misconception:

tar does not compress (unless used with special options), but puts files in a file (or originally on a tape). And you seem to be doing soemthing like

tar cf calc.tar calc.csv
cat calc.tar

so you'll see your file including that "meta information" you see. And have a look at du calc*: You don't save space because you don't compress anything.

This is not the intended use of tar! If you want to save space, you'll probably want to do

gzip calc.csv
zcat calc.csv.gz
  • Thanks for the reply...i don't want to compress anything....i just want to convert simple folder with csv file into .tar with same csv files (Eg. folder to folder.tar) and that tar contains csv files without any extra lines....i tried but my csv files in .tar folder contained extra lines like metadata – Tejas Thorave May 2 at 12:53
  • In this case, please edit your question's title (it says you want to compress). Also, a tar file needs to contain the metadata, otherwise, you wouldn't be able to untar it. If you just want all the contents of all csv files in one file, you simply need cat *.csv > /your/path/to/big-unified-table.csv – Philippos May 2 at 12:57
  • When i right click on folder to convert it into tar there is option "Compress.." and in compress there is .tar option to convert, so i think this is one type of compression...okay...forget about compression....when i convert the folder into .tar, i want files without any addition to the file content from .tar....please see the images attached in the question one is the simple csv file and after converting into .tar same file contained some extra lines into the file – Tejas Thorave May 2 at 13:20
  • Because that's what tar does: It combines the file's contents with its meta information. If you only want the contents, tar is the wrong tool. If you want to combine only the contents, use cat like dewscribed above. – Philippos May 2 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.