比如有如下目录:
app/test1/test1.tpl
app/test1/test2.tpl
app/test2/test1.tpl
app/test2/test2.tpl
app/test2/test3.tpl
app/test3/test1.tpl
...
读取文件,把符合条件的行归并到同一行。
比如:
test1文件夹里面的所有tpl文件符合的行全部合并到新文件的同一行。
test2文件夹里面的所有tpl文件符合的行全部合并到新文件另外一行。
求思路。
最后生成如下格式:
test1 function1 function2 fun fn
test2 var let count // 第一个为文件夹的名称,后面的为提取文件符合要求的单词
test3 async await promise
以下是我之前的过滤条件
find /home/work/src/app/* -name *.tpl|xargs -i{} sed -n '/component/{:a;N;/}/!ba;p}' {} | grep ['search{}'] | sed "s/component://g;s/}//g;s/{//g;s/[ ]["\t"]*//g;s/,//g;s/'//g;s/\"//g;s/\r\$//g" | awk -F [:/] '{print $NF}' | perl -ne 's/^\s*(\S+)\n$/\1 /g;print' | sed '/^$/d' > result.txt