简体   繁体   中英

Check given string in file using shell script

I want to check a string in a file irrespective of its case.

Sting is:

env=electron

This have to show matching if file shell.txt contain the give string in any form irrespective of case

Example shell.txt

Electron 
electron
ELECTRON
ElEcTRon   /* upper lower combination in any order have to chow matching */

How can I do this?

grep -i "electron" shell.txt

The -i is for ignore-case..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM