我已經將SQL數據導出爲Tab separted或逗號分隔格式的文本。第三列反向文本
2 AX Mariehamn Mariehamn ACTIVE 2011-03-15 17:23:12 2011-03-15 17:23:12 SYSTEM Al-Ma
4 DZ Adrar Adrar ACTIVE 2011-03-15 17:23:12 2011-03-15 17:23:12 SYSTEM Al-Ad
6 DZ Ain Defla Ain Defla ACTIVE 2011-03-15 17:23:12 2011-03-15 17:23:12 SYSTEM Al-Ai
8 DZ Ain Temchent Ain Temchent ACTIVE 2011-03-15 17:23:12 2011-03-15 17:23:12 SYSTEM Al-Ai
10 DZ Shantanu Shantanu ACTIVE 2011-03-15 17:23:12 2011-03-15 17:23:12 SYSTEM Al-Al
2,"AX","Mariehamn","Mariehamn","ACTIVE","2011-03-15 17:23:12","2011-03-15 17:23:12","SYSTEM","Al-Ma"
4,"DZ","Adrar","Adrar","ACTIVE","2011-03-15 17:23:12","2011-03-15 17:23:12","SYSTEM","Al-Ad"
6,"DZ","Ain Defla","Ain Defla","ACTIVE","2011-03-15 17:23:12","2011-03-15 17:23:12","SYSTEM","Al-Ai"
8,"DZ","Ain Temchent","Ain Temchent","ACTIVE","2011-03-15 17:23:12","2011-03-15 17:23:12","SYSTEM","Al-Ai"
10,"DZ","Shantanu","Shantanu","ACTIVE","2011-03-15 17:23:12","2011-03-15 17:23:12","SYSTEM","Al-Al"
我需要如下所示顛倒第三列中的文本,同時保持其他列不變。
nmaheiraM
rardA
alfeD niA
tnehcmeT niA
unatnahS
可以使用上述任何一種(TAB或CSV)格式。
謝謝。在sed中#我可以使用-e替換文件。 awk中可能有類似的東西嗎?或者我必須保存> to.file,然後將文件移回? – shantanuo 2011-03-17 09:08:52
'perl -i.bak -F,-lape'$ F [2] = reverse $ F [2]; $ _ =加入「,」,@F'文件' – ikegami 2011-03-17 13:53:48
@ikegami,請將您的Perl解決方案作爲您自己的答案。 – kurumi 2011-03-17 14:54:02