Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

https://www.cyberciti.biz/faq/howto-search-find-file-for-text-string/

Find some text in many file inside a folder

grep "redeem reward" /home/tom/*.txt


grep and exclude or -v


display only the file that are not gunzip

...


[root@VRS4 openvswitch]# ls | grep gz -v
health.xml
nuageMon.log
nuageMon.log-20150910
nuage-rpc.log
nuage-rpc.log-20151103
nuage-service-extension-config.log
nuage-service-extension-config.log-20151030
nuage-SysMon.log
nuage-SysMon.log-20151030
nuage-vlan-config.log
nuage-vrs-config.log
nuage-vrs-config.log-20151030
ovsdb-server.log
ovsdb-server.log-20151030
ovs-vswitchd.log
ovs-vswitchd.log-20151103
vm-monitor.log
vm-monitor.log-20151030



in a file: exclude all line starting with '#'

[root@server1 me]# more /etc/vsftpd/vsftpd.conf | grep "#" -v
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES

...