我可能会迟到,但我会帮你回答: echo“col | u name1 | col | u name2 | col | u name3 | col | u name4”>sample | data.csv hive-e'如果需要,从表| name where子句中选择不同的concat(col | 1,“|”,col |”,col | 2,“|”,col |”,col | 3示例数据.csv
hive -e "use DataAnalysis;
select attack_cat,
case when attack_cat == 'Backdoor' then 'Backdoors'
when length(attack_cat) == 0 then 'Normal'
when attack_cat == 'Backdoors' then 'Backdoors'
when attack_cat == 'Fuzzers' then 'Fuzzers'
when attack_cat == 'Generic' then 'Generic'
when attack_cat == 'Reconnaissance' then 'Reconnaissance'
when attack_cat == 'Shellcode' then 'Shellcode'
when attack_cat == 'Worms' then 'Worms'
when attack_cat == 'Analysis' then 'Analysis'
when attack_cat == 'DoS' then 'DoS'
when attack_cat == 'Exploits' then 'Exploits'
when trim(attack_cat) == 'Fuzzers' then 'Fuzzers'
when trim(attack_cat) == 'Shellcode' then 'Shellcode'
when trim(attack_cat) == 'Reconnaissance' then 'Reconnaissance' end,
count(*) from actualattacks group by attack_cat;">/root/data/output/results2.csv
18条答案
按热度按时间gc0ot86w16#
我可能会迟到,但我会帮你回答:
echo“col | u name1 | col | u name2 | col | u name3 | col | u name4”>sample | data.csv hive-e'如果需要,从表| name where子句中选择不同的concat(col | 1,“|”,col |”,col | 2,“|”,col |”,col | 3示例数据.csv
zzwlnbp817#
此shell命令以csv格式将输出格式打印到
output.txt
没有列标题。cig3rfwq18#
使用命令:
hive-e“使用[数据库名称];从[table\u name]limit 10中选择*;“>/路径/到/文件/我的文件名.csv
我有一个巨大的数据集,其中的细节我试图组织和确定攻击的类型和每种类型的数量。我在实践中使用的一个例子是这样的: