8.5 Exercises
8.5.1 Zipping
See Section 12.0.11 for solutions.
Look at the file BanthracisProteome.txt using
more
andless
Create a new file ‘short.txt’ containing the first 200 lines of BanthracisProteome.txt. Then, zip the file.
To the same thing as in exercise 2 without every writing the file ‘short.txt’
Extract the first 100 lines from the zipped file ‘short.txt.gz’ and store them in a new zipped file ‘shorter.txt.gz’, without ever unzipping ‘short.txt.gz’
Create new files ‘Line1.txt’, ‘Line2.txt’, …, each containing only one line of ‘short.txt.gz’ without unzipping the file (Hint: use a while loop)
Combine the 100 files ‘Line1.txt’, ‘Line2.txt’, … to a zipped archive called ‘all.tar’
Now zip all ‘Line1.txt’, ‘Line2.txt’, … files individually and combine them to a new archive ‘zipped.tar’ without further zipping. Compare the sizes of the two archives.
Crate a directory ‘all’, copy the archive ‘all.tar’ there and extract it.
Clean up by deleting all Line* files, all archive files and the directory all with one command.