nested elements in bed file using awk
1
0
Entering edit mode
2.2 years ago

Hi everyone

I am using bedops solution given for the identification of nested elements from bed file at https://bedops.readthedocs.io/en/latest/content/reference/set-operations/nested-elements.html (mainly awk scripts)

and saved it as 1) script.awk ( and chmod 777 script.awk) 2) ./script.awk test.bed

which gives error of

/usr/bin/env: ‘awk -f’: No such file or directory

/usr/bin/env: use -[v]S to pass options in shebang lines

I tried all different options but can not fix this. I would appreciate all the suggestion.

coordinates bedops genome awk • 1.3k views
ADD COMMENT
0
Entering edit mode

Can you post the head of your script.awk file? Maybe something is wrong with your shebang (#!) line.

ADD REPLY
0
Entering edit mode

Here is script.awk

#!/usr/bin/env awk -f
{
    if (NR > 1) {
        currentChr = $1
        currentStart = $2
        currentStop = $3
        if ((previousStart < currentStart) && (previousStop > currentStop)) {
            print $0;
        }
        else {
            previousChr = currentChr
            previousStart = currentStart
            previousStop = currentStop
        }
    }
    else {
        previousChr = $1
        previousStart = $2
        previousStop = $3
    }
}
ADD REPLY
0
Entering edit mode

how about just awk -f /path/to/the/script.awk input.txt

ADD REPLY
3
Entering edit mode
2.2 years ago
Asaf 10k

#!/usr/bin/awk -f or #!/usr/bin/env -S awk -f

will work

ADD COMMENT
0
Entering edit mode
ADD REPLY
0
Entering edit mode

Its working now. thanks alot !!

ADD REPLY

Login before adding your answer.

Traffic: 1248 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6