I have created one file
that contains all the necessary info in it to create a download link. In each of the lines
/results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67
/results/analysis/output/Home/Auto_user_S5-00580-4-Medexome_65_028/plugin_out/FileExporter_out.52
the _user_S5-00580-6-Medexome
, the digit between the - before Medexome
is variable, but that line will match a line in the file that begins with R_2016_09_20_10_12_41_user_S5-00580-6-Medexome
. I need to read each of those two strings in variables and then use them to create a download link.
download link
http://xxx.xx.xxx.xxx ---- hardcode
/output/Home/Auto_user_S5-00580-4-Medexome_65_028/plugin_out/FileExporter_out.52 -- from line1 with the /, /results/analysis is removed
/ --- harcode
R_2016_09_01_10_24_52_user_S5-00580-4-Medexome -- from line R_
.tar.bz --- hardcode
the ---
are not part of the link just there for clarification i hope. Also, the
file
/results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67
/results/analysis/output/Home/Auto_user_S5-00580-4-Medexome_65_028/plugin_out/FileExporter_out.52
IonXpress_007 MEV21
IonXpress_008 MEV22
IonXpress_009 MEV23
R_2016_09_21_14_01_15_user_S5-00580-9-Medexome
IonXpress_001 MEC1
IonXpress_002 MEC32
IonXpress_003 MEC33
R_2016_09_21_11_26_19_user_S5-00580-8-Medexome
IonXpress_007 MEV37
IonXpress_008 MEV38
IonXpress_009 MEV39
R_2016_09_20_12_47_36_user_S5-00580-7-Medexome
IonXpress_004 MEV34
IonXpress_005 MEV35
IonXpress_006 MEV36
R_2016_09_20_10_12_41_user_S5-00580-6-Medexome
IonXpress_007 MEV45
IonXpress_008 MEV46
IonXpress_009 MEV47
R_2016_09_01_13_20_02_user_S5-00580-5-Medexome
IonXpress_004 MEV42
IonXpress_005 MEV43
IonXpress_006 MEV44
R_2016_09_01_10_24_52_user_S5-00580-4-Medexome
IonXpress_001 MEC1
IonXpress_002 MEV40
IonXpress_003 MEV41
R_2016_08_03_10_42_57_user_S5-00580-2-Medical_Exome
awk
awk {
function pA(arg, string) {
string = arg
sub(/_R_.*/, "", string)
return string
}
print (u = $(i+1))
sub(/.*_user_/, "", u)
sub(/_.*/, "", u)
sub(/^/, "user_", u)
i += 2
continue
}' file
The above was an attempt to create the two variable to read in a bash
loop, but that had many errors. Is this possible or is there a better way? Thank you :).