2011年3月24日星期四

cope lined from multiple files of different folders

Q: I have 100 directories and each directory has a file with some name pattern, in it. I need to output the 15th line counted from the bottom of each file. How can I do this without copying all those files into another single directory.

A_1:
for i in `find . -type f -name "pattern"`;
do
tail -15 $i|head -1 >>redirect_somewhere
done

A_2:

没有评论:

发表评论