我想从下面的列表中创建文件。
如果名单上没有空格就没问题了..。但问题是它有一个空间
user@linux:~$ cat file.txt
Apples
Bing Cherry
Crab Apples
Dragon Fruit
user@linux:~$
之前
ser@pc:~$ ls -l
total 4
-rw-r--r-- 1 user user 44 Jun 9 14:06 file.txt
user@linux:~$
xargs触摸
user@linux:~$ cat file.txt | xargs touch
user@linux:~$
没有创建Apples, Bi
我有一个目录,里面有很多PDF文件名中有空格。 file 1.pdf
file 2.pdf
file 3.pdf
# And so on 我在该目录中运行了此命令。 pdftk `ls -v` cat output combined-report.pdf 但是终端产生了一堆像这样的错误。 Error: Unable to find file.
Error: Failed to open PDF file:
file
Error: Unable to find file.
Error: Failed to open PDF file:
1.pdf 如何使用pdftk或Arch
$ ls *mp3 | xargs mplayer
Playing Lemon.
File not found: 'Lemon'
Playing Tree.mp3.
File not found: 'Tree.mp3'
Exiting... (End of file) 命令失败是因为文件“Lemon Tree.mp3”,MP3包含空格,所以xargs认为它是两个文件。该如何处理?
示例:
% touch -- safe-name -name-with-dash-prefix "name with space" \
'name-with-double-quote"' "name-with-single-quote'" \
'name-with-backslash\'
xargs似乎无法处理双引号:
% ls | xargs ls -l
xargs: unmatched double quote; by default quotes are special to xargs u
您好,我是一个新手linux用户。我尝试使用bash中的find命令搜索给定的目录,每个目录包含多个同名但内容不同的文件,以便在这些文件中找到最大值。
最初,我没有将目录作为输入,并且知道文件的深度不会小于2个目录,所以我使用嵌套循环,如下所示:
prev_value=0
for i in <directory_name> ; do
if [ -d "$i" ]; then
cd $i
for j in "$i"/* ; do
if [ -d "$j" ]; then
cd $j
我用这种方式为/var/www/html中的所有文件制作指纹。
find /var/www/html -type f |xargs md5sum | tee /opt/figerprint.db.ori
效果很好。
现在,我想将tee命令的所有stdout重定向到/dev/null。
find /var/www/html -type f |xargs md5sum | tee /opt/figerprint.db.ori 1>/dev/null
md5sum: /var/www/html/news/uploads/Red: No such file or director