【发布时间】:2021-09-07 09:15:50
【问题描述】:
我有一个具有如下 ddl 的文件。现在以(如果不存在 tbl1 时创建表)开头的行中的第 6 列是表名。我想用 DB.table 名称替换表名。 并且在具有位置的行中,它应该填充 $tbl 作为表名。下面是示例输入和输出。
Create table if not exists tbl1 (
col1 int;
col2 string )
location hdfs://directory/$tbl
Create table if not exists tbl2 (
col3 int;
col2=4 float)
location hdfs://directory/$tbl
替换后的输出应该变成下面这样
Create table if not exists DB.tbl1 (
col1 int;
col2 string )
location hdfs://directory/tbl1
Create table if not exists DB.tbl2 (
col3 int;
col2=4 float)
location hdfs://directory/tbl2
任何人都可以建议如何实现这一目标
【问题讨论】:
标签: linux shell unix scripting