I want to combine awk and R language. The thing is that I have a set of *.txt files in a specified directory and that I don\'t know the length of the header from the files.
You can use system to run an external program from R.
system
system("gawk --version", intern=TRUE)