Category Archives: Uncategorized

extract lines in a text file using Awk

In bioinformatics, one commonly needs to extract some data from a big text file to check the data. The following code in Awk helps to do this:

awk ‘0 == (NR-1) % 100’ big_file.txt > small_file.txt

It extracts 1 line every other 100 lines in a text file, including the first line.

Advertisements