Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Awk 4.17 KB | None | 0 0
  1.  
  2. I have five static file. Meaning the same file will be used for all the day. This five file will not change. All the five file have only two column but number of row is different. Just I am giving the three files.  
  3.  
  4. infile1:
  5.  
  6. "aa"    "North"
  7. "bb"    "South"
  8. "cc"    "West"
  9. "dd"    "East"
  10. "ee"    "South"
  11. "ff"    "North"
  12.  
  13. infile2:
  14.  
  15. "it_grout1" "remote"
  16. "it_group_ind"  "oncall"
  17. "it_del"    "onsite"
  18. "it_mum"    "vend"
  19. "it_vill"   "oncall"
  20. "it_col"    "remote"
  21. "it_us"     "vend"
  22. "it_phy"    "oncall"
  23. "it_cov"    "onsite"
  24.  
  25.  
  26. infile3 :
  27.  
  28. "it_grout1" "name1"
  29. "it_group_ind"  "name2"
  30. "it_del"    "name5"
  31. "it_mum"    "name1"
  32. "it_vill"   "name4"
  33. "it_col"    "name3"
  34. "it_us"     "name3"
  35. "it_phy"    "name1"
  36. "it_cov"    "name4"
  37.  
  38.  
  39. This the main csv file :
  40.  
  41. sqlrawout.txt :
  42.  
  43. "05:32.2"   "3531010"   "3" "aa"    "it_grout1"
  44. "05:32.2"   "3552503"   "1" "bb"    "it_del"
  45. "05:32.2"   "3553002"   "1" "cc"    "it_mum"
  46. "05:32.2"   "3554879"   "3" "aa"    "it_col"
  47. "05:32.2"   "3573827"   "1" "ee"    "it_vill"
  48. "05:32.2"   "3575619"   "1" "dd"    "it_group_ind"
  49. "05:32.2"   "3578047"   "1" "bb"    "it_us"
  50. "05:32.2"   "3578794"   "1" "cc"    "it_phy"
  51. "05:32.2"   "3581188"   "1" "ff"    "it_vill"
  52. "05:32.2"   "3582117"   "1" "aa"    "it_group_ind"
  53. "05:32.2"   "3582172"   "1" "cc"    "it_del"
  54. "05:32.2"   "3582186"   "1" "ff"    "it_vill"
  55. "05:32.2"   "3582602"   "1" "bb"    "it_group_ind"
  56. "05:32.2"   "3582749"   "1" "ff"    "it_group_ind"
  57.  
  58.  
  59. I want to do the following steps :
  60.  
  61. 1).
  62.  
  63. If (column1 in infile1) is equal to (column 4 in sqlrawout.txt), then I want to add column 2 in infile1 to column 6 in sqlrawout.txt :
  64.  
  65. Output :
  66.  
  67. "05:32.2"   "3531010"   "3" "aa"    "it_grout1" "North"
  68. "05:32.2"   "3552503"   "1" "bb"    "it_del"    "South"
  69. "05:32.2"   "3553002"   "1" "cc"    "it_mum"    "West"
  70. "05:32.2"   "3554879"   "3" "aa"    "it_col"    "North"
  71. "05:32.2"   "3573827"   "1" "ee"    "it_vill"   "South"
  72. "05:32.2"   "3575619"   "1" "dd"    "it_group_ind"  "East"
  73. "05:32.2"   "3578047"   "1" "dd"    "it_us"     "East"
  74. "05:32.2"   "3578794"   "1" "cc"    "it_phy"    "West"
  75. "05:32.2"   "3581188"   "1" "ff"    "it_vill"   "North"
  76. "05:32.2"   "3582117"   "1" "aa"    "it_group_ind"  "North"
  77. "05:32.2"   "3582172"   "1" "cc"    "it_del"    "West"
  78. "05:32.2"   "3582186"   "1" "ff"    "it_vill"   "North"
  79. "05:32.2"   "3582602"   "1" "bb"    "it_group_ind"  "South"
  80. "05:32.2"   "3582749"   "1" "ff"    "it_group_ind"  "North"
  81.  
  82.  
  83. 2). If ( column 1 in infile2 ) is equal to (column  5 in sqlrawout.txt) then I want to merge column 2 in infile2 to column 7 in sqlrawout.txt.
  84.  
  85. "05:32.2"   "3531010"   "3" "aa"    "it_grout1" "North" "remote
  86. "05:32.2"   "3552503"   "1" "bb"    "it_del"    "South" "onsite
  87. "05:32.2"   "3553002"   "1" "cc"    "it_mum"    "West"  "vend"
  88. "05:32.2"   "3554879"   "3" "aa"    "it_col"    "Nort"  "remote"
  89. "05:32.2"   "3573827"   "1" "ee"    "it_vill"   "South" "oncall"
  90. "05:32.2"   "3575619"   "1" "dd"    "it_group_ind"  "East"  "oncall"
  91. "05:32.2"   "3578047"   "1" "dd"    "it_us"     "East"  "vend"
  92. "05:32.2"   "3578794"   "1" "cc"    "it_phy"    "West"  "oncall"
  93. "05:32.2"   "3581188"   "1" "ff"    "it_vill"   "North" "oncall"
  94. "05:32.2"   "3582117"   "1" "aa"    "it_group_ind"  "North" "oncall"
  95. "05:32.2"   "3582172"   "1" "cc"    "it_del"    "West"  "onsite"
  96. "05:32.2"   "3582186"   "1" "ff"    "it_vill"   "North" "oncall"
  97. "05:32.2"   "3582602"   "1" "bb"    "it_group_ind"  "South" "oncall"
  98. "05:32.2"   "3582749"   "1" "ff"    "it_group_ind"  "North" "oncall"
  99.  
  100.  
  101. 3). If ( column 1 in infile 3 ) is equal to (column  5 in sqlrawout.txt) then  I want to merge column 2 in infile3 to column 8 in sqlrawout.txt.
  102.  
  103.  
  104.  
  105. "05:32.2"   "3531010"   "3" "aa"    "it_grout1" "North" "remote"    "name1"
  106. "05:32.2"   "3552503"   "1" "bb"    "it_del"    "South" "onsite"    "name5"
  107. "05:32.2"   "3553002"   "1" "cc"    "it_mum"    "West"  "vend"      "name1"
  108. "05:32.2"   "3554879"   "3" "aa"    "it_col"    "Nort"  "remote"    "name3"
  109. "05:32.2"   "3573827"   "1" "ee"    "it_vill"   "South" "oncall"    "name4"
  110. "05:32.2"   "3575619"   "1" "dd"    "it_group_ind"  "East"  "oncall"    "name2"
  111. "05:32.2"   "3578047"   "1" "dd"    "it_us"     "East"  "vend"      "name3"
  112. "05:32.2"   "3578794"   "1" "cc"    "it_phy"    "West"  "oncall"    "name1"
  113. "05:32.2"   "3581188"   "1" "ff"    "it_vill"   "North" "oncall"    "name4"
  114. "05:32.2"   "3582117"   "1" "aa"    "it_group_ind"  "North" "oncall"    "name2"
  115. "05:32.2"   "3582172"   "1" "cc"    "it_del"    "West"  "onsite"    "name5"
  116. "05:32.2"   "3582186"   "1" "ff"    "it_vill"   "North" "oncall"    "name4"
  117. "05:32.2"   "3582602"   "1" "bb"    "it_group_ind"  "South" "oncall"    "name2"
  118. "05:32.2"   "3582749"   "1" "ff"    "it_group_ind"  "North" "oncall"    "name2"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement