Sponsored Content
Top Forums Shell Programming and Scripting To write a shell script which groups files with certain pattern, create a tar and zip Post 302334439 by rahu_sg on Wednesday 15th of July 2009 02:02:01 PM
Old 07-15-2009
To write a shell script which groups files with certain pattern, create a tar and zip

Hi Guru's,

I have to write a shell script which groups file names based upon the certain matching string pattern, then creates the Tar file for that particular group of files and then zips the Tar file created for the respective group of files.

For example, In the given directory these files of different patterns are present:

Pattern 1 (File name containing the numbers only)
---------
9319813.xls, 36713.xls, 5467.xls, 978.xls, 99813.xls, ... so on

Pattern 2
---------
1790006PosAc.doc, 34556PosAc.doc, 279226PosAc.doc, ... so on

Pattern 3
---------
NotFound_076957.xls, NotFound_2367957.xls, NotFound_7957.xls, ... so on

Pattern 4
---------
Total_3457947.rtf, Total_1347956.rtf, Total_0767957.rtf .... so on


So out of all the files present in the directory, the script should group the files based upon a particular pattern(i.e. pattern1, pattern 2, pattern 3, pattern4) and create a Tar file for a particular pattern and then zip the Tar file created.

Hence output of the script should be these 4 zipped tar files:
1)<some name>.xls.tar.gz
2) <some name>PosAc.doc.tar.gz
3) NotFound_<some name>.xls.tar.gz
4) Total_<some name>.rtf.tar.gz

My development environment is SunOS 5.9

Please help me out, as this is very important for me.

Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to create a Tar of multiple Files in Unix and FTP the tar to Windows.

Hi, On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files. a) /usr/users/oracle/bin b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies

2. Shell Programming and Scripting

How to write bash script to explode multiple zip files

I have a directory full of zip files. How would I write a bash script to enumerate all the zip files, remove the ".zip" from the file name, create a directory by that name and unzip each zip file into its corresponding directory? Thanks! Siegfried (3 Replies)
Discussion started by: siegfried
3 Replies

3. UNIX for Dummies Questions & Answers

Create a shell script for write files with 2 parameters

Hello, I'm a newbie in shell script. So, i would like to create a shell script which take 2 IN parameters (PARAM1 and PARAM2). This script need to create 2 files as : I need to create this file /etc/apache2/sites-available/PARAM2 : <VirtualHost *:80> DocumentRoot "/home/PARAM1/www"... (0 Replies)
Discussion started by: chatlumo
0 Replies

4. Shell Programming and Scripting

Write an automated shell program(s) that can create, monitor the log files and report the issues for

Hi , Please help me getting this done. Write an automated shell program(s) that can create, monitor the log files and report the issues for matching pattern. (i) Conditions for creating log files. Log file is created with date (example 2010_03_27.log). If the log file size is 10 Mb for... (1 Reply)
Discussion started by: itian2010
1 Replies

5. Homework & Coursework Questions

shell script that can create, monitor the log files and report the issues for matching pattern

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write an automated shell program(s) that can create, monitor the log files and report the issues for matching... (0 Replies)
Discussion started by: itian2010
0 Replies

6. UNIX for Dummies Questions & Answers

TAR and ZIP files

Hi, I need a help with zip and tar. I have no done any scripts before with zip command. What I need to achieve is list files in a directory with a specific name (ID_DATE format- given examples) and then zip (or gunzip which I need to use, I am not sure) with timestamp on the file name and then... (15 Replies)
Discussion started by: Vijay81
15 Replies

7. Shell Programming and Scripting

Urgent...Need a shell script to list files which belong to particular groups

Hi, I am just new to scripting but got to write a complex scipt please help. i need a shell script which can check the list of data listed in a txt doc and see if they belong to any of the groups that are listed in other list file.... (5 Replies)
Discussion started by: draghun9
5 Replies

8. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

9. Shell Programming and Scripting

Using Shell Script in place of Perl script to Unzip the zip files.

Hi Expert, We have some shell scripts which Internally uses Perl Script to Unzip the source zip files which comes to inbound directory. So now our requirement is to avoid the dependency on Perl Script and us Shell Script to unzip the files. I have the Perl script with me attached can some one... (3 Replies)
Discussion started by: naveen.dasu
3 Replies

10. UNIX for Beginners Questions & Answers

How to zip csv files having specific pattern in a directory using UNIX shell script?

I have files in a Linux directory . Some of the file is listed below -rw-rw-r--. 1 roots roots 0 Dec 23 02:17 zzz_123_00000_A_1.csv -rw-rw-r--. 1 roots roots 0 Dec 23 02:18 zzz_121_00000_A_2.csv -rw-rw-r--. 1 roots roots 0 Dec 23 02:18 zzz_124_00000_A_3.csv drwxrwxr-x. 2 roots roots 6 Dec 23... (4 Replies)
Discussion started by: Balraj
4 Replies
SSGREP(1)							       GNOME								 SSGREP(1)

NAME
ssgrep - search spreadsheets for strings SYNOPSIS
ssgrep [OPTIONS] [FILES] DESCRIPTION
This manual page briefly documents the ssgrep command. ssgrep is a command line utility to search for strings in spreadsheets of any format supported by gnumeric. OPTIONS
This program follows the usual GNU command line syntax, with single letter options starting with a single dash (`-') and longer options starting with two dashes (`--'). Options controlling input file handling --recalc Recalculate all cells Options controlling patterns and pattern matching -f, --keyword-file=FILE The path to a text file containing one key per line -i, --ignore-case Ignore differences in letter case -w, --word-regexp Match only whole words -F, --fixed-strings Pattern is a set of fixed strings -R, --search-results Search results of expressions too -v, --invert-match Search for cells that do not match Options controlling output in general -c, --count Only print a count of matches per file -L, --files-without-matches Print filenames without matches -l, --files-with-matches Print filenames with matches -q, --quiet Suppress all normal output -H, --with-filename Print the filename for each match -h, --without-filename Do not print the filename for each match -n, --print-locus Print the location of each match -T, --print-type Print the location type of each match Help options -V, --version Display ssgrep's version -?, --help Display the supported options --usage Display a brief usage message EXAMPLE
To search for the string "SUM" in the file foo.gnumeric : ssgrep SUM foo.gnumeric To search for the strings from the file keywords in the spreadsheet foo.xls : ssgrep --keyword-file=keywords foo.xls LICENSE
ssgrep is licensed under the terms of the General Public License (GPL), version 2. For information on this license look at the source code that came with the software or see the GNU project page <http://www.gnu.org>. COPYRIGHT
The copyright on ssgrep and the gnumeric software and source code is held by the individual authors as is documented in the source code. AUTHOR
ssgrep's primary author is Jody Goldberg <jody@gnome.org>; ssgrep builds on the gnumeric codebase. The initial version of this manpage was based on ssindex.1 by J.H.M. Dassen (Ray) <jdassen@debian.org>. SEE ALSO
beagled(1), gnumeric(1), ssconvert(1), ssindex(1) The Gnumeric Homepage <http://www.gnome.org/projects/gnumeric/>. The GNOME project page <http://www.gnome.org/>. gnumeric 2009-02-08 SSGREP(1)
All times are GMT -4. The time now is 10:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy