如何在前端添加10个空间| Unix |
我有一个文本文件:abc.txt
,其中包含下面的数据,
A Apple a day keeps a doctor away
B I like to play with Ball
C I have cat at my home
D My Dog name is bob
我想在屏幕上显示输出的前端10个空间,然后我的文件数据
预期输出:
A Apple a day keeps a doctor away
B I like to play with Ball
C I have cat at my home
D My Dog name is bob
< Strong>我已经尝试过,但不起作用
命令:
cat ABC.txt | column -t
I have a text file : ABC.txt
which contain below data
A Apple a day keeps a doctor away
B I like to play with Ball
C I have cat at my home
D My Dog name is bob
I want to display output on my screen with 10 spaces in a frontend and then my file data
Expected output :
A Apple a day keeps a doctor away
B I like to play with Ball
C I have cat at my home
D My Dog name is bob
I have tried this but not working
Command :
cat ABC.txt | column -t
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
^
匹配行的开头,这将其替换为10个空间。如果空间数量有所不同,则可以计算
前缀
变量,而不是硬编码。参见我如何在bash中重复一个角色?^
matches the beginning of the line, and this replaces it with 10 spaces.If the number of spaces can vary, you can calculate the
prefix
variable instead of hard-coding it. See How can I repeat a character in Bash?