简体   繁体   English

导出 csv 文件中的命令树结果,带列

[英]Export results of the command tree in csv file with columns

I need to save the results of our directory structure, only folders, from the linux server and export the results in a csv file with columns.我需要从 linux 服务器保存我们的目录结构的结果,仅文件夹,并将结果导出到带有列的 csv 文件中。

What I tried and works best is tree -d /path/folder/ -L 3 > file.csv I tried to combine with column but my knowledge is ye.. limited.我尝试过并且效果最好的是tree -d /path/folder/ -L 3 > file.csv我试图与column结合,但我的知识是有限的。

Best would be if I can list the first level of a directory in column A, second level in column B and the last one in column C.如果我可以在 A 列中列出目录的第一级,在 B 列中列出第二级,在 C 列中列出最后一个目录,那最好。

Assuming you want to only list files that are three levels deep:假设您只想列出三层深度的文件:

find . -maxdepth 3 -mindepth 3 | sed 's:./::;s:/:,:g' > file.csv

But I generally don't see any goods from trying to translate a file structure to a csv file.但是我通常看不到任何尝试将文件结构转换为 csv 文件的好处。 That doesn't seem to be any useful.这似乎没有任何用处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM