tags:

views:

17

answers:

1

I'm trying to run 10 files here.I'm getting the following error. does any one know how to fix it. It is working fine with <10 files but I need to use it 10 or 50 files.

$ sh skipper.sh file1 filea fileb filec filec fileb filea fileb filec fileb awk: cmd. line:2: (FILENAME=filec FNR=7) fatal: cannot open file `file10' for re ading (No such file or directory)

here is my code

awk -v nfiles="10" 'NR==FNR{a[$0]++;next}
$0 in a {a[$0]++; next}
{b[$0]++}
END{
  for(i in a){
    if(a[i]==nfiles) {
      print i > "output1"
    }
    else if(a[i]==1) {
        print i > "output3"
    }
  }
  for(i in b){
    if(b[i]==nfiles-1) {
        print i > "output2"
    }
  }
}' $1 $2 $3 $4 $5 $6 $7 $8 $9 $10
+1  A: 

When you hit argument 10 and above, you should use braces eg

${10}
ghostdog74