Unix + Shell script

The below are the some of list of gzip files. My requirement is i may select 1 or 2 or n no.of gzip files from below, that time all the data from selected files should export into a '.txt' file.
How to do that, with a single command how can I export multiples files data into a txt file...  pls help???

-rw-r--r-- 1 s2badm wasgrp  56495 Nov  7 04:00 tracer.err.20773.07Nov2010_040033.gz
-rw-r--r-- 1 s2badm wasgrp  52307 Nov  8 04:00 tracer.err.23354.08Nov2010_040025.gz
-rw-r--r-- 1 s2badm wasgrp  48857 Nov  8 04:00 tracer.err.20773.08Nov2010_040025.gz
-rw-r--r-- 1 s2badm wasgrp 325994 Nov  9 04:03 tracer.err.23354.09Nov2010_040308.gz
-rw-r--r-- 1 s2badm wasgrp 319670 Nov  9 04:03 tracer.err.20773.09Nov2010_040308.gz
-rw-r--r-- 1 s2badm wasgrp 292450 Nov 10 04:03 tracer.err.20773.10Nov2010_040357.gz
-rw-r--r-- 1 s2badm wasgrp 297237 Nov 10 04:03 tracer.err.23354.10Nov2010_040357.gz
-rw-r--r-- 1 s2badm wasgrp 288204 Nov 11 04:03 tracer.err.23354.11Nov2010_040324.gz
-rw-r--r-- 1 s2badm wasgrp 289533 Nov 11 04:03 tracer.err.20773.11Nov2010_040324.gz
-rw-r--r-- 1 s2badm wasgrp 302498 Nov 12 04:03 tracer.err.23354.12Nov2010_040346.gz
-rw-r--r-- 1 s2badm wasgrp 297098 Nov 12 04:03 tracer.err.20773.12Nov2010_040346.gz
Who is Participating?
larsrohrConnect With a Mentor Commented:
If your machine has the gzcat command available, how about:
  gzcat file1.gz file2.gz ... filen.gz > myoutputfile.txt

(If you don't have gzcat, try zcat; or just use gunzip -c)

Is this what you had in mind?
Hatrix76Connect With a Mentor Commented:
you can do something like that:

for file in tracer.err.23354.10Nov2010_040357.gz tracer.err.23354.12Nov2010_040346.gz; do echo $file |  sed -e 's/.*\.\([0-9]\{2\}[a-zA-Z]\{3\}.*\)\.gz/\1/' >> output.txt ; zcat $file >> output.txt ; done

for all files you put in the in clause it does this:
this extracts date and time from the filename
writes the date and time to output.txt
writes the content from this filename to output.txt

If I understood correctly you want this? Or did you mean another time to write into the output file?

Sounds a little like homework.  What do you have so far that we can help you with?
Srinivasu_VAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.