creating a multiple zip files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting creating a multiple zip files
# 1  
Old 12-17-2010
[Solved] creating a multiple zip files

Hi,

Please help me,

i need a single line command for te below steps

1: listing a directory
2: searching a particular pattern in the names and creating the zip files of each

eg :
Code:
ls -lrt | grep jil | awk '{print $9}'

output is 

kap.jil
pranabjil
pranabjil1
pranabjil2
tmpjil12
a.jil
pppppp.jil
partyref.jil
kkkkkkk.jil
retjil.ksh
newjil
newprodjil.lt
newprodjil.box
newprodjil
xxxxxxxx.jil
xxxx.jil
tmpjil1
temp.jil

I am searching the pattern with jil. and i am getting the file name. I want the zip files of them.

Please advice me on this.

Thanks in advance.
Pranab Rana

---------- Post updated at 03:56 PM ---------- Previous update was at 03:55 PM ----------

got the answer

Code:
ls -lrt | grep jil | awk '{print $9}'  | xargs gzip





Quote:
Originally Posted by pranabrana
Hi,

Please help me,

i need a single line command for te below steps

1: listing a directory
2: searching a particular pattern in the names and creating the zip files of each

eg :
Code:
ls -lrt | grep jil | awk '{print $9}'

output is 

kap.jil
pranabjil
pranabjil1
pranabjil2
tmpjil12
a.jil
pppppp.jil
partyref.jil
kkkkkkk.jil
retjil.ksh
newjil
newprodjil.lt
newprodjil.box
newprodjil
xxxxxxxx.jil
xxxx.jil
tmpjil1
temp.jil

I am searching the pattern with jil. and i am getting the file name. I want the zip files of them.

Please advice me on this.

Thanks in advance.
Pranab Rana

Last edited by vbe; 12-17-2010 at 06:25 AM.. Reason: Code tags, please... (typos)
# 2  
Old 12-17-2010
Quote:
I am searching the pattern with jil. and i am getting the file name. I want the zip files of them.
Was not very clear want you wanted...
Anyway thanks for letting us know you found what you wanted
Login or Register to Ask a Question

Previous Thread | Next Thread

9 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 Multiple zip files and Strip directory

I receive multiple zipped directories with files in them, so the .zip name is the name of the directory containing the files. so i have used a simple loop to unzip all of them but when unzipped i have folders/directories, i wanted to strip these directories and remain with the actual files from... (1 Reply)
Discussion started by: buggzdiq
1 Replies

4. Shell Programming and Scripting

Create multiple zip files each containing 50 xml files.

Hi, Is there a direct command or need to write a shell script for following requirement? Everyday a folder is populated with approx 25k to 30k xml files. I need to create multiple zip files in the same folder each containing 50 xml files. The last zip file may or may not contain 50 xml files.... (6 Replies)
Discussion started by: Rakesh Thobula
6 Replies

5. Shell Programming and Scripting

Creating zip files

Hi All, I have a requirement where I have to pick csv files from another unix server by searching the list of files by their name and then copy to my server. Then I want to create their zip file and save it on my server. How can I do it using unix shell script. Please help me with the... (1 Reply)
Discussion started by: anil029
1 Replies

6. 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

7. UNIX for Dummies Questions & Answers

Zip multiple files recursively via UNIX

Hello, After searching, I didn't find any answer to execute my task. Her what I want to achieve on my MAC : Create a ZIP file (not tar.gz or other) from a file I want the ZIP created to have the name of the original file I want to do this on multiple files (314 exactly) So at the end the... (3 Replies)
Discussion started by: anou
3 Replies

8. UNIX for Dummies Questions & Answers

Zip multiple files and copy to help

Hi All, I have a set of large files ~ 500_900Mb I have generated and I'd like to quickly zip and copy them to a new folder elsewhere ... Can anyone suggest a quicky ?? Cheers :) (3 Replies)
Discussion started by: pawannoel
3 Replies

9. 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
Login or Register to Ask a Question