Hi,

I am a newbie with scripting so I can't find an easy solution to this question by myself and I'd like to ask for some help.

I have a long list of BED files, and for each file I want to scan them row by row and if the content of a given column contains some text I am looking for (say, for example, gene name "A") I want that full row to be copied into a new, separate bed file.

I'm looking fwd to hearing your suggestions,

thanks in advance!
If Input file contains gene name in fourth column, then it will print only that line

    cat input.bed | awk 'BEGIN {OFS="\t"} { if ($4 == "geneName") { print $0 }}' > outputFile

If you have many bed files and want to loop

```
for name in $(ls *bed)
do
  cat $name | awk 'BEGIN {OFS="\t"} { if ($4 == "geneName") { print $0 }}' >> outputFile
done
```