Zip certain files having filenames alphanumerically bigger than others

kikibobo

I gzipped files in a slurm job. But job canceled before it is done. It takes so long(~10min for a file, and there is 200 files). How can I zip only the remaining files which are not zipped yet?

$ ls
 
SRR7121484_1.fastq
SRR7121484_1.fastq.gz
SRR7121484_2.fastq
SRR7121484_2.fastq.gz
SRR7121485_1.fastq
SRR7121485_2.fastq
SRR7121488_1.fastq
SRR7121488_2.fastq
....

As you see, all the remaining files are bigger than the number 7121485. I tried to extract this value and use conditionals, however no success yet.

Thanks in advance!

muru

You can just run gzip on all the fastq files directly. By default, it will ask if you want to overwrite the existing files:

$ gzip -k *.fastq
SRR7121484_1.fastq.gz already exists -- do you wish to overwrite (y or n)?

If gzip can't read anything from standard input, it simply skips these files:

% gzip -k *.fastq -v < /dev/null
gzip: SRR7121484_1.fastq.gz already exists -- skipping
gzip: SRR7121484_2.fastq.gz already exists -- skipping
SRR7121485_1.fastq:   -99.9% -- replaced with SRR7121485_1.fastq.gz
SRR7121485_2.fastq:   -99.9% -- replaced with SRR7121485_2.fastq.gz
SRR7121488_1.fastq:   -99.9% -- replaced with SRR7121488_1.fastq.gz
SRR7121488_2.fastq:   -99.9% -- replaced with SRR7121488_2.fastq.gz

So, just run:

gzip -k *.fastq < /dev/null

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Find the first line having a variable value bigger than a specific number

From Dev

Splitting files into chunks with size bigger than 127

From Dev

Upload files bigger than 2Mo Symfony2

From Dev

How to make a slider with the middle item is bigger than others?

From Dev

MySQL/PHP - Need to be able to produce query results with certain columns having more weight than others

From Dev

Delete files with filenames longer than x

From Dev

Extract certain files from .zip

From Dev

Download the files that are bigger than a certain size

From Dev

Are Certain EC2 Instance Types Provisioned Faster than Others?

From Dev

How copy files bigger than 4.3 GB in java

From Dev

Creation of a zip with multiple files having same name

From Dev

Photo upload not uploading files bigger than 2MB

From Dev

Encoding of cyrillic filenames in zip files

From Dev

How can I find files that are bigger/smaller than x bytes?

From Dev

Use rsync to copy all files except for certain filenames with a certain extension

From Dev

Getting filenames from zip files

From Dev

Android JAVA $_FILE returms empty at files bigger than ~ 50 mb

From Dev

delete files having a certain pattern in their names

From Dev

Identify all files having no permission for others using find command

From Dev

Splitting files into chunks with size bigger than 127

From Dev

find and remove files bigger than a specific size and type

From Dev

How to sum the values bigger than certain value in Excel?

From Dev

Is it possible to list the files between two names alphanumerically?

From Dev

How to rsync files with filename number bigger than a number?

From Dev

Download the files that are bigger than a certain size

From Dev

Bash - Find - move files bigger than certain size

From Dev

xfs disk usage is 15-30% bigger than the files

From Dev

Extract files from zip archive excluding certain filenames

From Dev

writeRaster to .img file sizes are much bigger than source files

Related Related

  1. 1

    Find the first line having a variable value bigger than a specific number

  2. 2

    Splitting files into chunks with size bigger than 127

  3. 3

    Upload files bigger than 2Mo Symfony2

  4. 4

    How to make a slider with the middle item is bigger than others?

  5. 5

    MySQL/PHP - Need to be able to produce query results with certain columns having more weight than others

  6. 6

    Delete files with filenames longer than x

  7. 7

    Extract certain files from .zip

  8. 8

    Download the files that are bigger than a certain size

  9. 9

    Are Certain EC2 Instance Types Provisioned Faster than Others?

  10. 10

    How copy files bigger than 4.3 GB in java

  11. 11

    Creation of a zip with multiple files having same name

  12. 12

    Photo upload not uploading files bigger than 2MB

  13. 13

    Encoding of cyrillic filenames in zip files

  14. 14

    How can I find files that are bigger/smaller than x bytes?

  15. 15

    Use rsync to copy all files except for certain filenames with a certain extension

  16. 16

    Getting filenames from zip files

  17. 17

    Android JAVA $_FILE returms empty at files bigger than ~ 50 mb

  18. 18

    delete files having a certain pattern in their names

  19. 19

    Identify all files having no permission for others using find command

  20. 20

    Splitting files into chunks with size bigger than 127

  21. 21

    find and remove files bigger than a specific size and type

  22. 22

    How to sum the values bigger than certain value in Excel?

  23. 23

    Is it possible to list the files between two names alphanumerically?

  24. 24

    How to rsync files with filename number bigger than a number?

  25. 25

    Download the files that are bigger than a certain size

  26. 26

    Bash - Find - move files bigger than certain size

  27. 27

    xfs disk usage is 15-30% bigger than the files

  28. 28

    Extract files from zip archive excluding certain filenames

  29. 29

    writeRaster to .img file sizes are much bigger than source files

HotTag

Archive