alexpgp: (Interpreter's life)
[personal profile] alexpgp
One thing I learned yesterday was that tar files are not for editing. :)

I thought I had stumbled upon a slick way of concatenating a group of text files (which is what HTML files are, essentially) into one large file (which is what tar does, essentially), but was disabused of that notion when I tried to "untar" the result, which threw a bunch of errors at me. The content had somehow, "inexplicably" changed (because I had changed it using a text editor), and that was enough to throw everything off.

All was not lost, however, as I was able to open the edited tar file and manually extract all forty-odd files, one by one, and save them as required. Something of a lesson for me, I guess.

My eyeballs are ready to stage a coup d'etat, so I think I'll quit the house for a few hours and go look at trees, or something.

Cheers...

tar -cvf archiveName.tar directory

Date: 2009-08-19 07:16 am (UTC)
From: [identity profile] mrflash818.livejournal.com
tar -xvf archiveName.tar

and to make a tar into a compressed tar
gzip archiveName.tar
turns into archiveName.tar.gz

and to decompress
gunzip archiveName.tar.gz
turns into archiveName.tar

Re: tar -cvf archiveName.tar directory

Date: 2009-08-19 03:05 pm (UTC)
From: [identity profile] alexpgp.livejournal.com
Thank you for the information.

Cheers...

Date: 2009-08-19 01:00 pm (UTC)
From: [identity profile] bdunbar.livejournal.com
I thought I had stumbled upon a slick way of concatenating a group of text files ... into one large file


Use cat. Given three text files whose content is the same as the file name ...

% ls
one.txt three.txt two.txt
% cat one.txt two.txt three.txt > four.txt
% more four.txt
one
two
three
%

Date: 2009-08-19 03:05 pm (UTC)
From: [identity profile] alexpgp.livejournal.com
Ah, but what I need is something that'll take one.txt, two.txt, and three.txt and create a file that looks like this:
--one.txt--
one
--two.txt--
two
--three.txt--
three
so I can go in, edit the content (making sure not to mess with file delimiters), and eventually use another one-liner to split this combined file into its constituents.

With a little time, I'm sure I could've put together a suitable Perl script to do the job, but a wholly inadequate knowledge of how tar works led me astray.

Thanks for the suggestion.

Cheers...
Edited Date: 2009-08-19 03:18 pm (UTC)

Profile

alexpgp: (Default)
alexpgp

January 2018

S M T W T F S
  1 2 3456
7 8910111213
14 15 16 17181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Oct. 3rd, 2025 04:41 pm
Powered by Dreamwidth Studios