diff tool_template_render.R @ 11:670e1591cc65 draft

update
author mingchen0919
date Sat, 24 Feb 2018 10:44:30 -0500
parents a9f93a4742b1
children 9cf29b2374a6
line wrap: on
line diff
--- a/tool_template_render.R	Fri Feb 23 15:58:55 2018 -0500
+++ b/tool_template_render.R	Sat Feb 24 10:44:30 2018 -0500
@@ -2,6 +2,7 @@
 sink(zz)
 sink(zz, type = "message")
 
+
 # bring user inputs and command line arguments to R
 spec_matrix = as.matrix(
   data.frame(stringsAsFactors=FALSE,
@@ -17,6 +18,10 @@
 opt = getopt::getopt(spec_matrix)
 opt
 
-rmarkdown::render(input = opt$X_t, output_file = opt$X_O)
+# build command: awk '{print $1,$2}' > output.txt and run
+X_A = paste0(paste0('$', trimws(strsplit(opt$X_A, ',')[[1]])), collapse = ',')
+extract_field_command = paste0("awk '{print ", X_A, " }' ", opt$X_B, " > ", opt$X_O)
+system(command = extract_field_command)
+
 
 sink()