Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ tree
- .
- ├── Original_folder
- │ └── cat.txt
- ├── folderCD
- │ └── cat.txt
- ├── folderGK
- │ └── cat.txt
- ├── folderFE
- └── cat.txt
- 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....
- #!/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
- (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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement