如何加入文件名的多行成一个自定义分隔符? [英] How to join multiple lines of file names into one with custom delimiter?

查看:326
本文介绍了如何加入文件名的多行成一个自定义分隔符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想加盟 LS的结果-1 成一行,并与任何我想要的分隔它。

有没有什么标准的Linux命令我可以用它来实现这一目标?


解决方案

  

修改:只需 LS -m 如果你想你的分隔符是一个逗号。


啊,功率和简单!

  LS -1 | TR的'\\ n'','

更改逗号 ,以任何你想要的。请注意,这包括一个尾随逗号

I would like to join the result of ls -1 into one line and delimit it with whatever i want.

Are there any standard Linux commands I can use to achieve this?

解决方案

EDIT: Simply "ls -m" If you want your delimiter to be a comma

Ah, the power and simplicity !

ls -1 | tr '\n' ','

Change the comma "," to whatever you want. Note that this includes a "trailing comma"

这篇关于如何加入文件名的多行成一个自定义分隔符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆