# # SortAppr.R # # version: 1.0 # author: Giancarlo Panichi # date: 2020/10/09 print("Start SortApp.R") args <- commandArgs(trailingOnly = TRUE) print(args) print(paste("current dir: ",getwd()),sep="") setwd("/code/src") print(paste("working dir: ",getwd()),sep="") source("StorageHubCL.R") token<-args[1] itemid<-args[2] tempfolderitemid<-args[3] filename<-"sortableelements.txt" discoverStorageHub() downloadSH(itemid,filename) print("Read from SH...") print("Read data from file...") df <- read.table("sortableelements.txt",header = FALSE) print("Sort data...") df <- df[order(df[,1]),] print(df) print("Write data to file...") write.table(df, "result.txt", append = FALSE, sep = " ", dec = ".", row.names = FALSE, col.names = FALSE) print("Save on SH...") uploadSH(tempfolderitemid,"result.txt","result.txt","SortApp result") print("SortApp.R done")