I have a large number of files, all with the same format.
line 1: Gene ID
line 2: chromosomal position
line 3 - x: names of genetic variants)
I want to select only files containing at least 5 variants (i.e. files that have at least 10 lines in total). If a file has at least 5 variants I want to write the content minus the first two rows to a new file.
Below I provide two example input files, foo1
and foo2
.
foo1:
echo {885743,4:139381:3783883,rs93487,rs82727,rs111} | tr " " "\n" > foo1
foo2:
echo {10432,1:3747548:2192993,rs10204,rs262222,rs436363,rs3636,rs9878,rs11856} | tr " " "\n" > foo2
Desired output file (in this case only 1 file, in reality there will be multiple separate output files): foo2.checked
, looking like:
rs10204
rs262222
rs436363
rs3636
rs9878
rs11856