daily pastebin goal
18%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Incl    Cal Ps  Name    Q   Con Std Status
  2. True    255 A1  Sample 1    35.86       0  
  3. True    255 A2  Sample 2    36.06       0  
  4. True    255 A3  Sample 3    17.45       0  
  5. True    255 A4  Sample 4    17.56       0  
  6. True    255 A5  Sample 5    17.55       0  
  7. True    255 A6  Sample 6    40.00       0  
  8. True    255 A7  Sample 7    36.38       0  
  9. True    255 A8  Sample 8    27.98       0  
  10. True    255 A9  Sample 9    27.95       0  
  11. True    255 A10 Sample 10   28.19       0  
  12. True    255 A11 Sample 11   36.93       0  
  13. True    255 A12 Sample 12   37.74       0  
  14. True    255 A13 Sample 13   17.88       0  
  15. True    255 A14 Sample 14   17.82       0  
  16. True    255 A15 Sample 15   17.90       0  
  17. .
  18. .
  19. .
  20.      
  21. #!/bin/bash
  22.  
  23. # parse the data of desire columns from target file
  24. # rename the column name
  25. # redirect the stdoutput to a text file
  26.  
  27. for z in A B;
  28.   do for i in 3 4 5 13 14 15;
  29.     do grep $z$i aprilPlate.txt |
  30.        awk -F "t" '{print $3 "t" $5}' |
  31.        sed -e 's/A[3-5]/st_SWC/g;s/A[1][0-9]/st_SWD/g;s/B[3-5]/st_TZC/g;s/B[1][0-9]/st_TZD/g;' >> stone.txt;
  32.   done;
  33. done
  34.  
  35. for z in E F;
  36.   do for i in 8 9 10 18 19 20;
  37.     do grep $z$i aprilPlate.txt |
  38.        awk -F "t" '{print $3 "t" $5}' |
  39.        sed -e 's/E[8-9]|E[1][0]/su_SWC/g;s/E[1][0-9]|E[2][0]/su_SWD/g;s/F[8-9]|F[1][0]/su_TZC/g;s/F[1][0-9]|F[2][0]/su_TZD/g;' >> suy.txt;
  40.   done;
  41. done
  42.  
  43. paste -d't' stone.txt suy.txt >> aprilPlate.data.txt
  44.      
  45. st_SWC  17.45   su_SWC  28.85
  46. st_SWC  17.56   su_SWC  28.79
  47. st_SWC  17.55   su_SWC  28.82
  48. st_SWD  17.88   su_SWD  29.24
  49. st_SWD  17.82   su_SWD  29.18
  50. st_SWD  17.90   su_SWD  29.23
  51. st_TZC  18.06   su_TZC  25.99
  52. st_TZC  18.09   su_TZC  25.98
  53. st_TZC  18.13   su_TZC  26.02
  54. st_TZD  17.75   su_TZD  25.00
  55. st_TZD  17.70   su_TZD  25.01
  56. st_TZD  17.69   su_TZD  24.98
  57.      
  58. for file in aprilPlate.txt  mayPlate.txt  junePlate.txt  julyPlate.txt  augustPlate.txt;
  59. do
  60. for z in A B;
  61.   do for i in 3 4 5 13 14 15;
  62.     do grep $z$i $file |
  63.        awk -F "t" '{print $3 "t" $5}' |
  64.        sed -e 's/A[3-5]/SWC/g;s/A[1][0-9]/SWD/g;s/B[3-5]/TZC/g;s/B[1][0-9]/TZD/g;' >> stone.txt;
  65.   done;
  66. done
  67. <snip>
  68. done
  69.      
  70. #!/bin/bash
  71. awksrc='BEGIN{FS=OFS="t"}
  72. { gsub(/A[345]|E[89]|E10/, "SWC");
  73.   gsub(/A1[0-9]|E1[1-9]|E20/, "SWD");
  74.   gsub(/B[345]|F[89]|F10/, "TZC");
  75.   gsub(/B1[0-9]|F1[1-9]|F20/, "TZD");
  76. }
  77. /SW[CD]{print $3, $5 >"stone.txt"}
  78. /TZ[CD]{print $3, $5 >"suy.txt"}'
  79. for file in aprilPlate.txt mayPlate.txt junePlate.txt julyPlate.txt ...
  80. do
  81.     awk "$awkscr" $file >/dev/null
  82.     paste -d't' stone.txt suy.txt >> ${file%.txt}.data.txt
  83. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top