I have big files which I wanna filter them based on first column.
first column should be one of these strings: chr2L || chr2R || chr3L || chr3R || chr4 || chrX
and something like chr2Lh or chrY or chrM3L is not accepted.
Is there easier way to do it? or is it true anyway?!!
And BTW, I wanna sort based on two column which the first is string and second is number and you see what I used in the code above. Please let me know if it's true also.
Try to avoid regex's if you can, to improve efficiency. Also, if you happen to know, to a reasonable extent, the frequency of occurrence of those strings, you could use simple string comparisons (with the proper order of comparisons) with the short-circuit logical OR ( || ) operator.