Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 vertica 复制脚本 (A.copy.vsql),它将数据从具有 HEADER、TRAILER 和 DETAIL RECORDS 的文件加载到表中。
Vertica Copy 语句可以跳过 1 条记录,这意味着我知道如何删除标题。
我想知道我是否可以以相同的方式切割预告片?
另外,如果我不能像标题一样将其切碎,那么我可以在 VSQL 本身(A.copy.vsql)中编写简单的 linux SED 命令来完成这项工作吗?
如果要从文件中删除第一行和最后一行,可以使用:
sed '1d;$d' file
并在命令中使用 pattern command file,可以使用 bash 使用进程替换:
command file
command <(sed '1d;$d' file)
1和$是绝对地址,1 表示第一行,而$表示最后一行。 d删除寻址的行。
1
$
d
<(...)是过程替代。
<(...)