findstr word1 file
findstr /C:"word1 word2" file
findstr /S /C:"word1 word2" file
+ subdir
findstr -I /C:"word1 word2" file
ignore up/low
findstr /I /S /C:"word1 word2" file
+ ignore up/low
H:\ADMIN> findstr bunk *.htm
adhoc.htm:
...
H:\ADMIN> findstr daily *.htm *.txt
gmp.htm:xxxx daily xxx
cifprod_tty.txt:xxxx daily xxx
...
H:\ADMIN> findstr bunk *.htm
adhoc.htm:
...
search in 2 files extension
H:\ADMIN> findstr daily *.htm *.txt
gmp.htm:xxxx daily xxx
cifprod_tty.txt:xxxx daily xxx
...
AND
H:\ADMIN> findstr /c:"partition auth fail" hsm*
AND up+low
H:\ADMIN> findstr -i /c:"partition auth fail" hsm*
hsm.htm: Partition Auth Fail Limit: 5
hsm.htm: Partition Auth Fail Action: 0 (lock)
hsm.htm: Partition Auth Fail Limit: 5
hsm2014.htm: Partition Auth Fail Action: 0 (lock)
hsm2014.htm: Partition Auth Fail Limit: 5
hsm2014.htm: Partition Auth Fail Action: 0 (lock)
hsm2014.htm: Partition Auth Fail Limit: 5
OR up+low
H:\ADMIN> findstr -i "partition auth fail" hsm*
hsm201202err:NTLS/SSL TCP Connectivity: FAILED
hsm201202err:HSM Partition Activation Status: PASSED
hsm201202err:Failed Group Logins: 0
hsm201202err:Partitions Total: 250
hsm2014.htm:Successfully unlocked partition HSM1:bkbbc
hsm2018.htm:SO Auth Fail Count: 0
hsm2018.htm:SO Auth Fail Limit: 0
hsm2018.htm:SO Auth Fail Action: 0 (zeroize)
hsm2018.htm:Partition Auth Fail Limit: 3
H:\ADMIN> findstr /i /c:"partition fail" hsm*
nothing
2 finds (= pipe): H:\ADMIN> findstr _bunk0 *.htm | findstr cle|sort(*) cle.htm = error!! sort: H:\ADMIN> findstr _bunk0 *.htm | findstr "alt=\"\"" |sortbank.htm: ![]()
cle.htm:
gmp_24.htm:![]()
gmp_247.htm:![]()
gmp_sic.htm:![]()
count: H:\ADMIN> findstr _bunk0 *.htm | findstr "alt=\"\"" |find /c "alt"adhoc.htm:
adsm.htm:
afp.htm:
...448H:\ADMIN> findstr _bunk0 *.htm | findstr "alt=\"BC\"" |find /c "alt"88special char: H:\ADMIN> findstr _bunk0 *.htm | findstr "alt=\"BC\""igt2000.htm:
trxtest.htm:
hsm.htm:
hard.htm:
...
si l'on cherche plus puissant... (je passe par l'ubuntu de mon W10)
= recherche dans des répertoires (vtt2019, vtt2020, vtt2021...)
ou
on remplace "find -path "?/vtt*/*" -name "*.htm"
Recherche des fichiers modifiés today + trié par datetime
$ find . -mtime 0 -printf "%T@ %Tc %p\n" | sort -n
...
1643300937.1883494000 Thu Jan 27 17:28:57 2022 ./ski/20200111realp.htm
1643301222.8497336000 Thu Jan 27 17:33:42 2022 ./ski/20170310.htm
1643301270.4795105000 Thu Jan 27 17:34:30 2022 ./ski/20220115winterhorn.htm
1643301270.4951395000 Thu Jan 27 17:34:30 2022 ./ski/20170211gaschney.htm
1643301270.5266460000 Thu Jan 27 17:34:30 2022 ./ski/201702barme.htm
1643301492.3455802000 Thu Jan 27 17:38:12 2022 ./ski/20201027engelberg.htm
1643301923.0898666000 Thu Jan 27 17:45:23 2022 ./ski/20190323.htm
Find (répertoire) + del si vide
[pam_cke@bs02-t ~]$ touch rr/1/7777
[pam_cke@bs02-t ~]$ find rr -type d -empty
rr/2
rr/3
rr/45
rr/6
[pam_cke@bs02-t ~]$ find rr -type d -empty -delete
[pam_cke@bs02-t ~]$ find rr -type d -empty
[pam_cke@bs02-t ~]$ find rr -type d
rr
rr/1
[pam_cke@bs02-t ~]$ find rr -type f
rr/1/7777
rr/4444
more info (YT)
trouve les rep. "thumb" n'ayant de fichier "resume2_*"
/mnt/d/data_html/xxx/rando$ cd 20251010
$ find . -type d -name "thumb" -exec sh -c 'find "$1" -type f -iname "*resume2_*" | grep -q . || echo "$1"' _ {} \;
./thumb
/mnt/d/data_html/xxx/rando$ find . -name "*resume2_*"
./20240413/thumb/resume2_256.jpg
./20240421/thumb/resume2_256.jpg
./20240526/thumb/resume2_256.jpg
...
= recherche dans des répertoires (vtt2019, vtt2020, vtt2021...)
# find . -wholename "./vtt*/*.htm"
# find . -wholename "./vtt*/*.htm" -exec grep utf-8 {} \; -print
# find . -wholename "./vtt*/*.htm" -exec grep 'class="vtt"' {} \; -print
# find . -wholename "./vtt*/*.htm" -exec grep 'class="who"' {} \; -print
== important! (dans quel répertoire)
on remplace "find -name ..." par "find -wholename ..."ou
on remplace "find -path "?/vtt*/*" -name "*.htm"
Recherche des fichiers modifiés today + trié par datetime
Find (répertoire) + del si vide
trouve les rep. "thumb" n'ayant de fichier "resume2_*"
/mnt/d/data_html/xxx/rando$ cd 20251010
$ find . -type d -name "thumb" -exec sh -c 'find "$1" -type f -iname "*resume2_*" | grep -q . || echo "$1"' _ {} \;
