How to zip or rm the multi part named files?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to zip or rm the multi part named files?
# 8  
Old 09-25-2013
All of the uses of:
Code:
for i in `pipeline`

will set the variable i to the elements in the output from the pipeline split on the spaces and newlines in the output. You need something that will just split on the newlines. If you didn't want to restrict your processing to the oldest ten matching files, you could just use:
Code:
for i in "MDB_Kernel11.1_gwlog_SUN 22_09_2013"*

With the restriction, you could try:
Code:
ls -rt "MDB_Kernel11.1_gwlog_SUN 22_09_2013"* | head -10 | while IFS='' read -r i
do      gzip "$i"
done

but I'm guessing you probably want something like:
Code:
ls -rt "MDB_Kernel11.1_gwlog_SUN 22_09_2013"* | grep -v '.gz$' | head -10 | while IFS='' read -r i
do      gzip "$i"
done

# 9  
Old 09-25-2013
It is working fine with the below command.


Code:
find . -name "MDB_Kernel11.1_gwlog_TUE 24_09_2013*"  -type f | xargs -I xx rm -rf xx

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (1 Reply)
Discussion started by: b.saipriyanka
1 Replies

2. UNIX for Beginners Questions & Answers

How can we Zip multiple files created on the same date into one single zip file.?

Hi all i am very new to shell scripting and need some help from you to learn 1)i have some log files that gets generated on daily basis example: i have abc_2017_01_30_1.log ,2017_01_30_2.log like wise so i want to zip this 4 logs which are created on same date into one zip folder. 2)Post zipping... (2 Replies)
Discussion started by: b.saipriyanka
2 Replies

3. Shell Programming and Scripting

Unzip all the files with subdirectories present and append a part of string from the main .zip files

Hi frnds, My requirement is I have a zip file with name say eg: test_ABC_UH_ccde2a_awdeaea_20150422.zip within that there are subdirectories on each directory we again have .zip files and in that we have files like mama20150422.gz and so on. Iam in need of a bash script so that it unzips... (0 Replies)
Discussion started by: Ravi Kishore
0 Replies

4. Shell Programming and Scripting

Zip Multiple files to One .zip file in AIX system

Hi I have a requirement in unix shell where I need to zip multiple files on server to one single .zip file. I dont see zip command in AIX and gzip command not doing completely what I want. One I do .zip file, I should be able to unzip in my local Computer. Here is example what I want... (9 Replies)
Discussion started by: RAMA PULI
9 Replies

5. Shell Programming and Scripting

Working with files that are named with a timestamp

So I have a script that runs an ls on a given directory and looks for files with a timestamp that has the current hour in it and then does work with the files that it discovers DATE=`date +'%y%m%d%H'` HOSTIS=`hostname` #EMAIL NOTIFICATION ALS EMAIL=address@server.com # if ; then ... (5 Replies)
Discussion started by: os2mac
5 Replies

6. AIX

ZIP multiple files and also specify size of zip file

I have to zip many pdf files and the size of zip file must not exceed 200 MB. When size is more than 200 MB then multiple zip files needs to be created. How we can achieve this in UNIX? I have tried ZIP utility but it takes a lot of time when we add individual pdfs by looping through a... (1 Reply)
Discussion started by: tom007
1 Replies

7. Shell Programming and Scripting

cat certain files in directories to files named after the dir?

Hi all, I have a directory with many subdirectories each named like so: KOG0001, KOG0002, ...KOG9999. Each of these subdirectories contain a variable number two kinds of files (nuc and prot) named like so: Capitella_sp_nuc_hits.fasta (nuc) and Capitella_sp_prot_hits.fasta (prot). The... (2 Replies)
Discussion started by: kmkocot
2 Replies

8. UNIX for Dummies Questions & Answers

multi part compressed files

Hi there, not sure if I am in the right place but here is my question. I have a file that is over 100mb and my host does not allow FTP of files above 100mb so I thought I would use a compression utility to compress it into smaller parts say 10mb each, upload them and then re-assemble them on... (7 Replies)
Discussion started by: gffb
7 Replies

9. UNIX for Dummies Questions & Answers

unzip .zip file and list the files included in the .zip archive

Hello, I am trying to return the name of the resulting file from a .zip archive file using unix unzip command. unzip c07212007.cef7081.zip Archive: c07212007.cef7081.zip SecureZIP for z/OS by PKWARE inflating: CEP/CEM7080/PPVBILL/PASS/G0063V00 I used the following command to unzip in... (5 Replies)
Discussion started by: oracledev
5 Replies

10. UNIX for Dummies Questions & Answers

Best practice for bulk multi-part mail

Hi, I am currently building a PHP/MySQL database that handles our offices newsletters. Now everything works great in the alpha with only a few names in the list, but I anticipate that once we fill it up (around 10,000) that this will not work from the PHP. I already have the script echo the... (0 Replies)
Discussion started by: begin23
0 Replies
Login or Register to Ask a Question