Sto*_*Fox 3 linux bash shell sed find
如何使用find
?在名称中包含空格的目录中搜索文件?我使用脚本
#!/bin/bash
for i in `find "/tmp/1/" -iname "*.txt" | sed 's/[0-9A-Za-z]*\.txt//g'`
do
for j in `ls "$i" | grep sh | sed 's/\.txt//g'`
do
find "/tmp/2/" -iname "$j.sh" -exec cp {} "$i" \;
done
done
Run Code Online (Sandbox Code Playgroud)
但是不处理名称中包含空格的文件和目录?
这将抓取所有包含空格的文件
$ls
more space nospace stillnospace this is space
$find -type f -name "* *"
./this is space
./more space
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4708 次 |
最近记录: |