shell - 使用shell将数据从文本文件添加到excel
问题描述
我有以下命令的 2 个输出(使用 SHELL)
输出 1
bash-4.2$ cat job4.txt | cut -f2 -d ":" | cut -f1 -d "-"
Gathering Facts
Upload the zipped binaries to repository
Find the file applicatons in remote node
Upload to repository
include_tasks
Check and create on path if release directory exists
change dir
include_tasks
New release is unzipped
Starting release to unzip package delivered
Get the file contents
Completed
Playbook run took 0 days, 0 hours, 5 minutes, 51 seconds
输出 2
bash-4.2$ awk '{print $NF}' job4.txt
4.78s
2.48s
1.87s
0.92s
0.71s
0.66s
0.55s
0.44s
0.24s
0.24s
0.24s
0.03s
seconds
我的实际输出应该是excel。就像输出 1 应该进入第 1 列,输出 2 应该进入第 2 列一样。
请建议。
解决方案
将第一个写入文件。同样对第二个文件也这样做。
cmd 在这里 > file1.txt
2ndcmd 在这里 > file2.txt
然后要逐行合并文件,您可以使用粘贴命令。您可以使用不同的分隔符“\t”并写入 csv
粘贴 file1.txt file2.txt > 合并文件.csv
参考:https ://geek-university.com/linux/merge-files-line-by-line/
推荐阅读
- arrays - 如何在 Svelte 中创建一个更新到本地存储的嵌套数组存储?
- java - lib/Pages/ChattingPage.dart:15:8: 错误: 未找到: 'dart:html' import 'dart:html' as html;
- react-native - 在 RN 中集成 HMS 广告
- websocket - 为什么在 socket.emit 上使用 socket.broadcast.emit 函数
- javascript - Owl-carousel 每个项目显示很多 3 个图像 - Laravel
- vb.net - 使用 DataGridViewCellStyle 在 DatagridView 中设置特殊属性
- javascript - Symfony Forms EntityType 使用 JS 全选
- node.js - 使用带有访问令牌的 Node JS API 的 Salesforce 身份验证
- javascript - 如何通过localStorage将具有封装(私有属性)的对象传递到另一个选项卡?
- openapi - Azure API 管理:使用可为空的属性验证内容