Archive for the ‘awk’ Category

 

HSQLのシングルクォーテーションとawk

1月 10th, 2014

update 文をawkで出力しようとしたら awkでシングルクォーテーションが出力出来なかった。 awk -v q=”‘” ‘{print “update \”UnitMaster\” set \”s1_lv\”=” $2 “,\”s2_lv\”=” $3 “, \”s3_lv\”=” $4 “, \”s4_lv\”=” $5 “, \”s5_lv\”=” $6 ” where \”id\”=” q $1 q;}’ こんな感じで -v を使い。 HSQLはopenofficeのbaseですがSQL実行時にcolumnはだぶるクォーテーション、値はシングルクォーテーションと使い分けが必要なようです。

Read full article | コメントは受け付けていません。