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.