LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tar and CSV (http://www.linuxquestions.org/questions/linux-newbie-8/tar-and-csv-34113/)

lhoff 10-29-2002 11:27 AM

tar and CSV
 
I want to create a database of the contents of my tarfiles. I read that I can list the contents of an archive by typing:

tar -t thisarchive.tar (or use --list instead of -t)

But, when I ran the above, my terminal just sat there silently.

I want to generate a CSV file with:
$tarfile_name,$file1_in_archive
$tarfile_name,$file2_in_archive
etc.

and then import the resulting CSV into a MySQL table that I have created.

I thought using tar -t would be a good starting place to build this kind of thing. But, even if I can figure out the -t or --list options, I have never written a shell script and don't know regular expressions, so I'm unable to implement my idea.

If anybody could give me a brief description of the basic components I will need to learn and use, then point me to more detailed (though learner-friendly!) coverage of same, I would be grateful.

Thanks!

akohlsmith 10-29-2002 12:23 PM

Tar looks at /dev/tape by default. You must use the -f switch to look at a different file.

e.g.
tar -cyvf myfile.tar.bz2 /path/to/what/to/archive/
tar -xyvf myfile.tar.bz2 -C /where/to/put/the/files
tar -tyvf myfile.tar.bz2

For backup logging, I just use FlexBackup. Google should find it for you. Works with tapes, files, whatever. Does multi-level backups, multiple backups on one tape, etc.

I like it a lot. Too bad it's no longer maintained. :-(


All times are GMT -5. The time now is 04:17 AM.