Andys1
asked on
Using gunzip and find command together
Hello,
I want to create separate gunzip files for every year from the all available files in the directory.
File extension starts with YYYYMMDD.tsv. Can anyone please help create te command?
Files would be
20070330.tsv
20070427.tsv
20070531.tsv
20070629.tsv
20070731.tsv
20070831.tsv
20070928.tsv
20071031.tsv
20071130.tsv
20071228.tsv
20080131.tsv
20080229.tsv
20080331.tsv
20080430.tsv
20080530.tsv
20080630.tsv
20080731.tsv
20080829.tsv
20080930.tsv
20081031.tsv
20081128.tsv
20081230.tsv
Output files taht I am looking for is
2008.gz
2007.gz, etc.
Thank you.
I want to create separate gunzip files for every year from the all available files in the directory.
File extension starts with YYYYMMDD.tsv. Can anyone please help create te command?
Files would be
20070330.tsv
20070427.tsv
20070531.tsv
20070629.tsv
20070731.tsv
20070831.tsv
20070928.tsv
20071031.tsv
20071130.tsv
20071228.tsv
20080131.tsv
20080229.tsv
20080331.tsv
20080430.tsv
20080530.tsv
20080630.tsv
20080731.tsv
20080829.tsv
20080930.tsv
20081031.tsv
20081128.tsv
20081230.tsv
Output files taht I am looking for is
2008.gz
2007.gz, etc.
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ozo, Now using it in the followin way.
#!/bin/perl
@y{map/^(\d{4})/,<*.txt>}= ();
system "tar -cvf $_.tar $_*.txt" for keys %y;
Thanks for your input. You deserve all the points!
#!/bin/perl
@y{map/^(\d{4})/,<*.txt>}=
system "tar -cvf $_.tar $_*.txt" for keys %y;
Thanks for your input. You deserve all the points!
ASKER
For eg.
2007.gz should contain zip of
20070330.tsv
20070427.tsv
20070531.tsv
20070629.tsv
Similarly 2008.gz should contain zip of
20080930.tsv
20081031.tsv
20081128.tsv
Let me know if the question is still unclear. Thanks