Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use grep in linux to find strings case-insensitive

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to use grep case-insensitive search strings in linux, Xiaobian thinks it is quite practical, so share it with you as a reference, I hope you can gain something after reading this article.

Linux is a free-to-use and freely distributed UNIX-like operating system, is a POSIX-based multi-user, multitasking, multi-threaded and multi-CPU operating system, using Linux to run major Unix tools, applications and network protocols.

grep is used to filter string information. grep is case sensitive by default, but grep can be case sensitive by using the option-i.

I. View grep tool version method

Figure 1 grep version query

2. How to use grep -i

Figure 2 grep is case insensitive

Remarks:

grep How to use: grep [options] PATTERN file

grep -i "error" #ignore case sensitivity

grep -v "grep" #Ignore the grep command itself and filter out lines containing grep characters in the document

Grep ignores itself during the process

When we look up a process by process ID, we do so by:

ps -ef | grep 2112

to find out, but this usually doesn't work:

[root@Linux-dtowen ~]# ps -ef | grep 2132

dtowen 2132 2118 0 22:51 ? 00:00:00 /usr/libexec/ibus-engine-pinyin --ibus

root 2247 2192 0 23:01 pts/1 00:00:00 grep 2132

2247 is obviously not what we want, so can we get rid of 2247? The answer is yes. As follows:

[root@Linux-dtowen ~]# ps -ef | grep 2132 | grep -v grep

dtowen 2132 2118 0 22:51 ? 00:00:00 /usr/libexec/ibus-engine-pinyin --ibus

About "how to use grep case-insensitive search string in linux" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report