perl - Reverse text of third column -


I exported SQL data from tabs in a different format than ported or comma.

  2 Ax Merihiman Merihman Secure 2011-03-15 17:23:12 2011-03-15 17:23:12 System Al-Maa 4 DZ Edar Adar Active 2011-03-15 17 : 23: 12 2011-03-15 17:23:12 System Al-Ed 6 Dies Anne Defella Activated 2011-03-15 17:23:12 2011-03-15 17:23:12 System Al-Ai 8 Dies an Temtenkent anne tentacente sequaye 2011-03 -15 17:23:12 2011-03-15 17:23:12 System Al-Ai DJ DJ Shantanu Shantanu Active 2011-03-15 17:23:12 2011-03-15 17:23:12 System Al-Al 2, "Ax", "Maryahman", "Maryahman", "Active", "2011-03-15 17:23:12", "2011-03-15 17:23: 12 "," system "," alma "4," DZ "," adar "," adar "," active "," 2011-03-15 17:23:12 "," 2011-03-15 17:23:12 "," system "," Al-Ed "6," Dies "," Anne Diffla "," Anne Diffla "," Active "," 2011-03-15 17:23:12 "," 2011-03-15 17:23:12 ", "System", "Al-Ai" 8, "Dies", "Ann Temamant", "Ann Temamant", "Active", "2011-03-15 17:23:12", "2011-03-15 17: 23:12 "," System "," Al-Aai "10," DZ "," Shantanu "," Shanti Yu "," Active "," 2011-03-15 17:23:12 "," 2011-03 -15 17:23:12 "," system "," al-al ",   

keeping me other columns untouched, to reverse the text in the third column as shown below the wanted.

  NAMAHRA M. RARD A LFD NIA TNAKMT NIA Antenah S   

Any of the above (tabs or CSV) formats can be used. >

You can use awk for CSV,

  $ awk - (I = Length = $ 3); i -> {s = s substrust ($ 3, i, 1)}; $ 3 = s; s = "" } 1 'OFS =', 'File2', 'Ax', 'Namaharaam', '' Merihaman '', '' Active '', 2011-03-15 17:23:12 "," 2011-03-15 17:23:12 "," System "," Al-Maa "4," DZ "," Rada ", "Adar", "active", "2011-03-15 17: 23:12", "2011-03-15 17:23:12", "system", "al-advert" 6, "dzed", " "," Al-Aai "8," Effied NIA "," Anne Diffla "," Active "," 2011- 03-15 17:23:12 "," 2011-03-15 17:23:12 "," "DZ", "Tenhemetti NIA", "Anne Temaentent", "Active", "2011-03-15 17:23:12", "2011-03-15 17:23:12", "System", "Al -A "10," DZ "," Untan "," Shantanu "," Active "," 2011-03-15 17:23:12 "," 2011-03-15 17:23:12 "," System " , "Al-Al"   

or if you have Ruby (1.9 +)

  $ ruby ​​-i.bak -F "," Nae '$ F [2] .Reppers! If $ F [2]; Update $ F.join (",") 'file   

print: If you want to save the file, just redirect it to a temporary file in awk

For example

  awk -F "I, 1)}; $ 3 = s; s = ""} 1 'OFS =', 'File & gt; Temporary & amp; amp; MV Temp File   

And by the way, Sed , to save the file from "inplace" - i

Comments