开发者

Search a file in Unix

开发者 https://www.devze.com 2023-02-09 09:25 出处:网络
I need to search a file in unix which starts with \"catalina\" find ... what to be used effectively -name, -exec ? Whats the expression

I need to search a file in unix which starts with "catalina"

 find ... what to be used effectively -name, -exec ? Whats the expression

Also I need to show few files at a time, then show some more. There are huge set of log files in there. I know there开发者_开发问答 is some expression, but forgot...


find /path/to/search/in -name 'catalina*'

Use iname to match case-insensitively.

To not be overwhelmed with a long list of files, filter through less (append |less). You can also use more instead of less.


If catalina is the file name, then use

find -name 'catalina*'

If catalina is the first word contained in the file, then use

find -type f | xargs head -v -n 1 | grep -B 1 -A 1 -e '^catalina'
0

精彩评论

暂无评论...
验证码 换一张
取 消