将split命令的输出写入单独的目录 [英] writing the output from split command to a separate directory

查看:78
本文介绍了将split命令的输出写入单独的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在使用split命令将文件拆分为单独的行,并将它们保存到与我正在执行命令的当前目录不同的目录中.

So I'm using split command to split a file into separate lines and save them into a different directory than the current directory which I'm executing the command.

split -l 1 -d -a 5 --additional-suffix=.txt file1.dat file toindex/

所以我想将输出文件写在 toindex/内,但这给我一个错误: split:额外的操作数"toindex/" .如果我没有输出目录路径或没有前缀(文件"),这将很好地工作.

so i want the output files to be written inside toindex/, but this gives me a error saying: split: extra operand ‘toindex/’. This works fine if I don't have the output dir path or don't have the prefix ("file").

如何使它正常工作?我需要有前缀以及附加后缀.

How do I get this to work? I need to have the prefix as well as the additional-suffix.

推荐答案

尝试:

split -l 1 -d -a 5 --additional-suffix=.txt file1.dat toindex/file

请注意,目录 toindex 必须存在.

Note that the directory toindex must exist.

这篇关于将split命令的输出写入单独的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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