This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to get unique counts saved in a file

Hello,

I am trying to extract the coverage counts from a file, and then sort these and have counts of the unique values. The coverage count data is in column 3 of my file.

I have been running this as my job, submitted on a slurm HPC:

awk '{print$3}' patient.coverage | sort | uniq -c > patient_coverage_counts

However this produces an empty output file and I am unsure why.

When I run

head patient.coverage | awk '{print$3}' | sort | uniq -c

The output prints to the output absolutely fine.

Any help or insight would be hugely appreciated!!

linux sort awk unique counts

If you using --wrap to submit then you should enclose the full command in quotes like --wrap="awk '{print $3}' patient.coverage | sort | uniq -c > patient_coverage_counts".

and trying

cut -f 3 patient.coverage | sort | uniq -c > patient_coverage_counts

? if that works, it's may be a problem with the 'dollar'

0 answers

No answers yet.

Log in to answer this question.