Separating peaks of chip-seq with specific length
You can do it by awk.
awk -v OFS=&quot;\t&quot; '{ if ( ($3-$2) &gt;= 500 &amp;&amp; ($3-$2) &lt;= 1000) { print } }' in.bed &gt; out.bed

Assuming there is no header.