Skip to main content
removed erroneous .sh extension (and path), added example commands which have -k/--keep
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228

Although you can parse the output from a find you have to take care of spaces etc. Unfortunately gunzip does not have a --keep/-k flag for keeping (like bzip2 and xz do have).

If would make a small script gunzipkeep that takes one parameter (the gzipped file) and does the decompression, put that script somewhere in your $PATH and call it with:

find /opt/fooapp/foosubdirectory -name "foo.ext.gz" -print0 | xargs -0 --norun-if-empty --max-args 1 /path/to/gunzipkeep.sh 

The script could be something like:

#!/bin/bash inname=$1 outname=${inname%.gz} gunzip -c "$inname" > "$outname" 

Although you can parse the output from a find you have to take care of spaces etc. Unfortunately gunzip does not have a -k flag for keeping.

If would make a small script gunzipkeep that takes one parameter (the gzipped file) and does the decompression and call it with:

find /opt/fooapp/foosubdirectory -name "foo.ext.gz" -print0 | xargs -0 --norun-if-empty --max-args 1 /path/to/gunzipkeep.sh 

The script could be something like:

#!/bin/bash inname=$1 outname=${inname%.gz} gunzip -c "$inname" > "$outname" 

Although you can parse the output from a find you have to take care of spaces etc. Unfortunately gunzip does not have a --keep/-k flag for keeping (like bzip2 and xz do have).

If would make a small script gunzipkeep that takes one parameter (the gzipped file) and does the decompression, put that script somewhere in your $PATH and call it with:

find /opt/fooapp/foosubdirectory -name "foo.ext.gz" -print0 | xargs -0 --norun-if-empty --max-args 1 gunzipkeep 

The script could be something like:

#!/bin/bash inname=$1 outname=${inname%.gz} gunzip -c "$inname" > "$outname" 
The script would not be called like an option
Source Link
Hauke Laging
  • 94.8k
  • 21
  • 132
  • 185

Although you can parse the output from a find you have to take care of spaces etc. Unfortunately gunzip does not have a -k flag for keeping.

If would make a small script gunzipkeep that takes one parameter (the gzipped file) and does the decompression and call it with:

find /opt/fooapp/foosubdirectory -name "foo.ext.gz" -print0 | xargs -0 --norun-if-empty --max-args 1 --/path/to/gunzipkeep.sh 

The script could be something like:

#!/bin/bash inname=$1 outname=${inname%.gz} gunzip -c "$inname" > "$outname" 

Although you can parse the output from a find you have to take care of spaces etc. Unfortunately gunzip does not have a -k flag for keeping.

If would make a small script gunzipkeep that takes one parameter (the gzipped file) and does the decompression and call it with:

find /opt/fooapp/foosubdirectory -name "foo.ext.gz" -print0 | xargs -0 --norun-if-empty --max-args 1 --gunzipkeep 

The script could be something like:

#!/bin/bash inname=$1 outname=${inname%.gz} gunzip -c "$inname" > "$outname" 

Although you can parse the output from a find you have to take care of spaces etc. Unfortunately gunzip does not have a -k flag for keeping.

If would make a small script gunzipkeep that takes one parameter (the gzipped file) and does the decompression and call it with:

find /opt/fooapp/foosubdirectory -name "foo.ext.gz" -print0 | xargs -0 --norun-if-empty --max-args 1 /path/to/gunzipkeep.sh 

The script could be something like:

#!/bin/bash inname=$1 outname=${inname%.gz} gunzip -c "$inname" > "$outname" 
changed start dir
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228

Although you can parse the output from a find you have to take care of spaces etc. Unfortunately gunzip does not have a -k flag for keeping.

If would make a small script gunzipkeep that takes one parameter (the gzipped file) and does the decompression and call it with:

find /opt/fooapp/foosubdirecotryfoosubdirectory -name "foo.ext.gz" -print0 | xargs -0 --norun-if-empty --max-args 1 --gunzipkeep 

The script could be something like:

#!/bin/bash inname=$1 outname=${inname%.gz} gunzip -c "$inname" > "$outname" 

Although you can parse the output from a find you have to take care of spaces etc. Unfortunately gunzip does not have a -k flag for keeping.

If would make a small script gunzipkeep that takes one parameter (the gzipped file) and does the decompression and call it with:

find /opt/fooapp/foosubdirecotry -name "foo.ext.gz" -print0 | xargs -0 --norun-if-empty --max-args 1 --gunzipkeep 

The script could be something like:

#!/bin/bash inname=$1 outname=${inname%.gz} gunzip -c "$inname" > "$outname" 

Although you can parse the output from a find you have to take care of spaces etc. Unfortunately gunzip does not have a -k flag for keeping.

If would make a small script gunzipkeep that takes one parameter (the gzipped file) and does the decompression and call it with:

find /opt/fooapp/foosubdirectory -name "foo.ext.gz" -print0 | xargs -0 --norun-if-empty --max-args 1 --gunzipkeep 

The script could be something like:

#!/bin/bash inname=$1 outname=${inname%.gz} gunzip -c "$inname" > "$outname" 
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228
Loading