brucezepplin
brucezepplin

Reputation: 9792

error when running .awk script

I have an awk script:

BEGIN { FS="_" }
/^>/ {
    id=$1;p=$2; wild=$3;subs=$4; c=$NF; next
}
{
    if (p-10<1) s=1
    else if (p+10>length($0)) s=length($0)-20
    else s=p-10
    print id"_"p"_"wild"_"subs">\n"substr($0,s,p-s) c substr($0,p+1,21-p+s)
}

and when I run I get the following:

$ cat test1.fasta | awk -f snp_flank.awk
bash: /usr/bin/awk: /usr/bin/awk: bad interpreter: Too many levels of symbolic links

what does this mean?

extra info:

$ ls -l /usr/bin/awk
lrwxrwxrwx 1 root root 21 2011-12-07 16:47 /usr/bin/awk -> /etc/alternatives/awk


$ head -n10 /usr/bin/awk
#!/usr/bin/awk -f

BEGIN { FS="_" }
/^>/ {
    id=$1;p=$2; wild=$3;subs=$4; c=$NF; next
}
{
    if (p-10<1) s=1
    else if (p+10>length($0)) s=length($0)-20
    else s=p-10

it appears I have accidentally replaced awk with an awk script! sorry! how do I fix this? would simply reinstalling awk sort this out?

Upvotes: 1

Views: 344

Answers (1)

Camusensei
Camusensei

Reputation: 1563

You have accidentally overwritten /usr/bin/awk.

Reinstall awk on your system.

sudo apt-get install --reinstall gawk

or

sudo yum reinstall gawk

depending on your system.

Upvotes: 1

Related Questions