1. To search a string from the content of files.
E.g. Search 'logo.gif' from all jsp,html and xsl files under current folder
2. To get lines in a certain range from file which is huge
E.g. Get the lines from 20 to 2000 from stdout.txt
E.g. Search 'logo.gif' from all jsp,html and xsl files under current folder
find . \( -name '*.jsp' -o -name '*.html' -o -name '*.xsl' \) -exec grep -l logo.gif {} \;2. To get lines in a certain range from file which is huge
E.g. Get the lines from 20 to 2000 from stdout.txt
sed -n '20,2000p' stdout.txt > test.txt
本文介绍了两种实用的文件处理技巧:一是如何在指定文件类型中查找特定字符串;二是如何从大型文件中提取指定范围内的行内容。这些技巧对于日常开发工作非常有用。
889

被折叠的 条评论
为什么被折叠?



