Quantcast
Channel: Nick Crawford
Viewing all articles
Browse latest Browse all 10

Sorting BED files with headers.

$
0
0

I’m trying to keep most of my genome stats in bed format. This makes it pretty easy to mix and match analyses. However, one task that seems to come up over and over is how to sort the files when they have a header. So I don’t have to remember it and you don’t have to spend anymore time googling it the easy ‘linux’ way to do this is with the following one-liner:

cat file.wheader.bed \
| { head -n 1; tail -n +2 \
| sort -k1,1 -k2,2g; } \
> file.wheader.sorted.bed

Enjoy.


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images