Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Unix中,如何显示以前缀开头的所有文件的内容?_Unix_Command Line - Fatal编程技术网

在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_*