Less -i or –ignore-case causes searches to ignore case; that is, uppercase and lowercase are considered identical. This option is ignored if any uppercase letters appear in the search pattern; in other words, if a pattern contains uppercase letters, then that search does not ignore case. Less -I or –IGNORE-CASE like -i, but searches ignore case even if the pattern contains uppercase letters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
## create a long file with 200 lines > myfile; i=1; while [ $i -le 200 ]; \ do echo "$i" >> myfile; ((i++)); done sed -i "100i HELLO" myfile ## inserts HELLO on line no. 100 of myfile sed -i "130i hello" myfile ## inserts hello on line no. 130 of myfile ## default less myfile ## in the interactive mode, type /hello ## finds hello, search is case sensitive ## less -i or --ignore-case option less -i myfile ## in the interactive mode, type /hello ## finds both hello and HELLO serach is not case ## sensitive if the search tearm is in lower case ## in the interactive mode, type /HELLO ## finds only HELLO, search is case sensitive if ## search tearm is in upper case ## less -I or --IGNORE-CASE option less -I myfile ## in the interactive mode, type /HELLO ## finds hello HELLO, search is not case sensitive ## even if the search tearm is in uppercase rm myfile |