在Unix中,如何显示以前缀开头的所有文件的内容?
一组以前缀在Unix中,如何显示以前缀开头的所有文件的内容?,unix,command-line,Unix,Command Line,一组以前缀r\uu开头的文本文件,我想一次显示所有这些文件的内容 我尝试使用cat和如下命令: cat [f_*] , 但这并不像我期望的那样工作您可以使用类似这样的脚本 path="<Your Path Here>" find $path -name "r_*" | while read -r currentFile; do while read -r line; do HERE $line will be each line
r\uu
开头的文本文件,我想一次显示所有这些文件的内容
我尝试使用cat
和如下命令:
cat [f_*] ,
但这并不像我期望的那样工作您可以使用类似这样的脚本
path="<Your Path Here>"
find $path -name "r_*" | while read -r currentFile;
do
while read -r line;
do
HERE $line will be each line
done < $currentFile
done
path=“”
在读取-r currentFile时查找$path-name“r_*”|;
做
而read-r行;
做
这里每行$line
完成<$currentFile
完成
这里find$path-name“r_*”
将查找给定路径中以r_*开头的所有文件,并逐个迭代每个文件。
循环
while read-r line
将读取每行内容,以便执行任何操作您可以使用类似这样的脚本
path="<Your Path Here>"
find $path -name "r_*" | while read -r currentFile;
do
while read -r line;
do
HERE $line will be each line
done < $currentFile
done
path=“”
在读取-r currentFile时查找$path-name“r_*”|;
做
而read-r行;
做
这里每行$line
完成<$currentFile
完成
这里find$path-name“r_*”
将查找给定路径中以r_*开头的所有文件,并逐个迭代每个文件。
读取时循环
-r行
将读取每行内容,以便您正确使用该cat
执行任何操作:
$ cat r_*
由于OP中关于起始字母有一些混淆,请继续使用:
cat[fr]\u*
正确使用该cat
:
$ cat r_*
由于OP中有一些关于起始字母的混淆,请继续使用:
cat[fr]\u*
您可以使用tail或head命令
tail -n +1 r_*
您可以使用tail或head命令
tail -n +1 r_*