sed从.csv中删除单词+空格unix |在solaris

时间:2017-09-06 14:44:21

标签: mysql bash oracle unix sed

我有以下csv文件,我想加载到Oracle表。

cat to_load_pplp.csv

Table PPL_CH_USAGE,178,01/Sep/2017 09:03:30,01/Sep/2017 09:03:30
PPL_INVOICE,22015731,01/Sep/2017 05:30:21,01/Sep/2017 05:30:21
PPL_LIABILITY,2468705,01/Sep/2017 06:56:41,01/Sep/2017 06:56:41
Table MBBSCS_PPL_INVOICE,3768639,01/Sep/2017 07:00:15,01/Sep/2017 07:00:15
Table MBBSCS_PPL_USAGE,1914718,01/Sep/2017 20:02:03,01/Sep/2017 20:02:03
CONTRACT_MSISDN,3785568,01/Sep/2017 04:00:26,01/Sep/2017 04:00:26
Table OCS_OFFER_CONF_2,16838060,01/Sep/2017 09:30:03,01/Sep/2017 09:30:03
Table OCS_OFFER_STATE_2,12902213,01/Sep/2017 09:30:03,01/Sep/2017 09:30:03
Table OCS_STATIC_2,5094735,01/Sep/2017 09:30:03,01/Sep/2017 09:30:03
Table FC_SAPIST_ALL_ITEMS,4579021,01/Sep/2017 02:40:54,01/Sep/2017 02:40:54
Table FC_SAPIST_OPEN_ITEMS,653676,01/Sep/2017 00:30:05,01/Sep/2017 00:30:05
Table FC_SAPIST_DY_ALL,993408,01/Sep/2017 12:46:46,01/Sep/2017 12:46:46
Table SC_LOAN_OVERVIEW_FACT_II,1392218,01/Sep/2017 08:10:31,01/Sep/2017 08:10:31
PPL_USAGE,21397132,01/Sep/2017 06:19:27,01/Sep/2017 06:19:27
PPL_USAGE,20339944,01/Sep/2017 10:20:16,01/Sep/2017 10:20:16
Table PPL_CH_USAGE,178,01/Sep/2017 09:03:30,01/Sep/2017 09:03:30

为了将它们加载到oracle表,如何删除单词" Table"和之后的空间?

例如,所需的输出将是:

PPL_CH_USAGE,178,01/Sep/2017 09:03:30,01/Sep/2017 09:03:30
PPL_INVOICE,22015731,01/Sep/2017 05:30:21,01/Sep/2017 05:30:21
PPL_LIABILITY,2468705,01/Sep/2017 06:56:41,01/Sep/2017 06:56:41
MBBSCS_PPL_INVOICE,3768639,01/Sep/2017 07:00:15,01/Sep/2017 07:00:15
MBBSCS_PPL_USAGE,1914718,01/Sep/2017 20:02:03,01/Sep/2017 20:02:03
CONTRACT_MSISDN,3785568,01/Sep/2017 04:00:26,01/Sep/2017 04:00:26
OCS_OFFER_CONF_2,16838060,01/Sep/2017 09:30:03,01/Sep/2017 09:30:03
OCS_OFFER_STATE_2,12902213,01/Sep/2017 09:30:03,01/Sep/2017 09:30:03
FC_SAPIST_DY_ALL,993408,01/Sep/2017 12:46:46,01/Sep/2017 12:46:46
OCS_STATIC_2,5094735,01/Sep/2017 09:30:03,01/Sep/2017 09:30:03
FC_SAPIST_ALL_ITEMS,4579021,01/Sep/2017 02:40:54,01/Sep/2017 02:40:54
FC_SAPIST_OPEN_ITEMS,653676,01/Sep/2017 00:30:05,01/Sep/2017 00:30:05
SC_LOAN_OVERVIEW_FACT_II,1392218,01/Sep/2017 08:10:31,01/Sep/2017 08:10:31
PPL_USAGE,21397132,01/Sep/2017 06:19:27,01/Sep/2017 06:19:27
PPL_USAGE,20339944,01/Sep/2017 10:20:16,01/Sep/2017 10:20:16
PPL_CH_USAGE,178,01/Sep/2017 09:03:30,01/Sep/2017 09:03:30

请帮助我:)

非常感谢!

2 个答案:

答案 0 :(得分:3)

使用替换命令:

sed 's/^Table //' file

答案 1 :(得分:3)

sed 's/^Table //g' -i to_load_pplp.csv

s代表替换,-i选项替换文件。