Each cat.txt file has 5 line before starting the column header.
Sample cat.txt file is like this
Version LRv1.10.0
Build date 2017-12-06
MOL-calc
PRESSURE
!
Time[s] InletT[K] InletP[Pa] O2_GasOut C_GasOut
100 0.000885 1000000 0.0007 0.2111
and so on....
I want to plot first column along with the column which have column header with a keyword "_GasOut". (There are unknown number of header with this keywords, For each column I would like to have a separate graph). Additionally, the graphical results of Original_folder should be plotted in the same graph for all the plots from folderCD, folderGK, folderFE...... and so on.
Corresponding graph should be saved in the corresponding folders with a title same as column header. In each graph there should be two legend one is "original_folder" and another is "folderCD/folderGK/......"
I got all the output plot commands for Original_folder in one txt file and plot commands for all the other folders into another txt file. After that I am not finding a way to go ahead..
#!/bin/bash
gawk -F $'\t'' # Using TABs as field separators /_GasOut/{ # On lines containing "_GasOut" for(f=1;f<=NF;f++){ # ... iterate over all fields on line this=$f # ... picking them up if(index(this,"_GasOut"))wanted[f]=1 # ... and noting which ones we want to print } } ENDFILE{ # As we reaach end of each file for(f in wanted){ # ... iterate over wanted fields if(length(cmds)) cmds = cmds ",\n" # ... adding commas and newlines if needed cmds = cmds "\"" FILENAME "\" using 1:" f # ... and adding the "using" statement } delete wanted # Forget list of wanted fields for next file } END{ # At very end of last file print cmds # ... print accumulated gnuplot cmds } ' folder*/cat.txt
The output txt file look like this
```
(Original_folder)
"Original_folder/cat.txt" using 1:22,
"Original_folder/cat.txt" using 1:23,
"Original_folder/cat.txt" using 1:24,
"Original_folder/cat.txt" using 1:25,
"Original_folder/cat.txt" using 1:26,
"Original_folder/cat.txt" using 1:27,
"Original_folder/cat.txt" using 1:28,
If the same code is used again for other folders.. the output is like this...
(Other folders)
"folderCD/cat.txt" using 1:22,
"folderCD/cat.txt" using 1:23,
"folderCD/cat.txt" using 1:24,
"folderCD/cat.txt" using 1:25,
"folderCD/cat.txt" using 1:26,
"folderCD/cat.txt" using 1:27,
"folderCD/cat.txt" using 1:28,
"folderGK/cat.txt" using 1:22,
"folderGK/cat.txt" using 1:23,
"folderGK/cat.txt" using 1:24,
"folderGK/cat.txt" using 1:25,
"folderGK/cat.txt" using 1:26,
"folderGK/cat.txt" using 1:27,
"folderGK/cat.txt" using 1:28
So i have all the command ready for gnuplot "plot" command, I just don't know how to arrange them to get a plot.
For example
for column 22 it is like
gnuplot>plot "Original_folder/cat.txt" using 1:22, \
"folderCD/cat.txt" using 1:22
```
How can I do this for all other cases ? And how to make the column header as title?
N.B: folder numbers are not fixed.
I added one of the cat.txt file for reference. https://1drv.ms/t/s!Aoomvi55MLAQh1wMmpnPGnliFmgg
My folder structure looks kind of like this
Each cat.txt file has 5 line before starting the column header.
Sample cat.txt file is like this
I want to plot first column along with the column which have column header with a keyword "_GasOut". (There are unknown number of header with this keywords, For each column I would like to have a separate graph). Additionally, the graphical results of Original_folder should be plotted in the same graph for all the plots from folderCD, folderGK, folderFE...... and so on.
Corresponding graph should be saved in the corresponding folders with a title same as column header. In each graph there should be two legend one is "original_folder" and another is "folderCD/folderGK/......"
I got all the output plot commands for Original_folder in one txt file and plot commands for all the other folders into another txt file. After that I am not finding a way to go ahead..
Here is the code
The output txt file look like this
```
(Original_folder)
"Original_folder/cat.txt" using 1:22,
"Original_folder/cat.txt" using 1:23,
"Original_folder/cat.txt" using 1:24,
"Original_folder/cat.txt" using 1:25,
"Original_folder/cat.txt" using 1:26,
"Original_folder/cat.txt" using 1:27,
"Original_folder/cat.txt" using 1:28,
(Other folders)
"folderCD/cat.txt" using 1:22,
"folderCD/cat.txt" using 1:23,
"folderCD/cat.txt" using 1:24,
"folderCD/cat.txt" using 1:25,
"folderCD/cat.txt" using 1:26,
"folderCD/cat.txt" using 1:27,
"folderCD/cat.txt" using 1:28,
"folderGK/cat.txt" using 1:22,
"folderGK/cat.txt" using 1:23,
"folderGK/cat.txt" using 1:24,
"folderGK/cat.txt" using 1:25,
"folderGK/cat.txt" using 1:26,
"folderGK/cat.txt" using 1:27,
"folderGK/cat.txt" using 1:28
gnuplot>plot "Original_folder/cat.txt" using 1:22, \ "folderCD/cat.txt" using 1:22
```
How can I do this for all other cases ? And how to make the column header as title?
N.B: folder numbers are not fixed.
I added one of the cat.txt file for reference. https://1drv.ms/t/s!Aoomvi55MLAQh1wMmpnPGnliFmgg