Compress 1st 20 Large different File using tar


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Compress 1st 20 Large different File using tar
# 1  
Old 03-26-2012
Compress 1st 20 Large different File using tar

Sorry guys.. dont know where to put this..

currently I am cleaning up system dump on our aix machine
and I wanted to set zero the 1st 20 large file but before doing
that I wanted to create some backup.

is there any command that can compress all these file same time?
tar syntax file?

server1$sudo du - am ./* | sort -nr | head -20
8200 ./sddsrv_bak.log
7688 ./sdd_bak.log
6048 ./sddsrv.log
3152 ./sdd.log
2048 ./cfglog
1832 ./devinst.log
1104 ./errlog
752 ./errtmplt
392 ./codepoint.cat
256 ./nimlog
256 ./bootlog
216 ./nim.installp
176 ./diag_log.bck_sav
128 ./dumpsymplog
104 ./lvmcfg.log
72 ./emgr.log
64 ./conslog
40 ./vgbackuplog
40 ./image.data
32 ./bosinstlog
# 2  
Old 03-26-2012
Try this. Untested:

Code:
sudo du - am ./* | sort -nr | head -20 | awk '{print $2}' | xargs tar -cvf archive.tar

# 3  
Old 03-26-2012
thanks mate...you are the man Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compress a tar file to smaller size

I have a tar file with name DTT012_GP_20140207.tar and many more with different names of different sizes ranging from 1GB to 4GB. Now my requirement is to extract/not extract these files and then divide it into various parts of size 500MB and save it with different names and then compress... (5 Replies)
Discussion started by: Shaibal_bp
5 Replies

2. AIX

tar: 0511-825 The file 'file' is too large.

Dears, i am trying to comprees file but it gave me error as below: userhost>tar cvf - file | gzip > file.tar.gz tar: 0511-825 The file 'file' is too large. Be noted that this file is nearly to "9 Giga". Please, advise Thanks & Reagrds, Please use code tags! Also please do not... (3 Replies)
Discussion started by: mohammedmostafa
3 Replies

3. Shell Programming and Scripting

identify files with "Normal termination" and compress them into a .tar.gz file

Hi, I have hundreds of files "*.out" located in one folder, and I want to: 1. Identify the good files containing "Normal termination" (grep "Normal termination" *.out ) 2. Compress the good files into a tar.gz file (tar cvfz good.tar.gz *.goog.out ) Is there a way I can automate this... (4 Replies)
Discussion started by: rockytodd
4 Replies

4. Shell Programming and Scripting

tar and compress in one step

I know there is a way to tar up directory and sub-directories and have it compressed all in one command but but the syntax escapes me. I seem to re-call something like this: tar -cvf /tmp/file.tar - | compress ? Can somebody please provide me with the syntax on how to tar/compress and... (6 Replies)
Discussion started by: BeefStu
6 Replies

5. UNIX for Dummies Questions & Answers

Compress the file using Tar command

Hi, When i am tar the file particular ,csv file format in a folder i am receiving the error Command: tar cf New_data.tar /new/file/mari/getdata/small/*.xml Arguements too long But sometimes i am able to compress other folder but the tar folder contains all the file format and... (10 Replies)
Discussion started by: marivinay
10 Replies

6. UNIX for Dummies Questions & Answers

Issue: Compress in unix server and FTP to windows and open the compress file using Winzip

Hi All ! We have to compress a big data file in unix server and transfer it to windows and uncompress it using winzip in windows. I have used the utility ZIP like the below. zip -e <newfilename> df2_test_extract.dat but when I compress files greater than 4 gb using zip utility, it... (4 Replies)
Discussion started by: sakthifire
4 Replies

7. UNIX Desktop Questions & Answers

file zip,rar,tar,compress,uncompress,unzip,unrar

i want know how to compress and uncompress file using unix, compress uncompress,zip,unzip,rar,unrar,how its work and more about this.:confused: (1 Reply)
Discussion started by: ismael xavier
1 Replies

8. Shell Programming and Scripting

Search, Tar and Compress in one line

Hi all, I am supposed to collect a huge amount of log files from a unix system (HP-UX) onto a local system. The log files are not in one place, but they are scattered all over the Unix server. The unix server has only limited space, so that I can not create a tar file first and then compress it.... (4 Replies)
Discussion started by: bluesky099
4 Replies

9. UNIX for Dummies Questions & Answers

Using TAR on a large file

I am runnign Solaris 8. I am trying to TAR a large file (13 gig) and it is complaining about the size. Any suggestions? (4 Replies)
Discussion started by: hshapiro
4 Replies

10. UNIX for Advanced & Expert Users

tar and compress

I need to compress and tar a couple files in a directory, but I also want the original files unchanged, ie if I compress a1.cpp , then a1.cpp becomes a1.cpp.z, but what I want after running the compress utility is to have both a1.cpp as it is and a1.cpp.z and then tar a1.cpp.z to an... (4 Replies)
Discussion started by: muru
4 Replies
Login or Register to Ask a Question