I want to combine awk and R-language. The fact is that I have a set of * .txt files in the specified directory and that I do not know the length of the header from the files. In some cases, I have to skip 25 lines, and in others, skip 27, etc. So I want to type some awk commands to skip the number of lines. Once I have this value, I can start processing the data with R.
Also, in the R file, I am combining R a bash, so my code looks like this:
!/usr/bin/env Rscript ... argv <- commandArgs(T) **error checking...** import_file <- argv[1] export_file <- argv[2] **
Where and how can I enter the awk command. Thanks!
I tried to do what you told me about awk commands, and I still get an error message. The program does not recognize my command, so I can not enter the number of lines to go to my function. Here is my code:
** nline <- paste ('$ (grep -n' m / s 'import_file | awk -F ":"' {print $ 1} ')')
nline <- scan (pipe (nline), quiet = T) **
I am looking for the m / s template in the first column to find out where I have the header text. I am using R under w7.
Jpv
source share