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 |
display only the file that are not gunzip grep and exclude or -v | In a directory: [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 pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES
|
Exclude '#' and empty line: | jlk@ubuntu:~/open-nti$ more ./docker/telegraf/telegraf.conf | grep "#" -v | grep -v "^[[:space:]]*$" [global_tags] [agent] interval = "10s" round_interval = true metric_batch_size = 1000 metric_buffer_limit = 10000 collection_jitter = "0s" flush_interval = "10s" flush_jitter = "0s" debug = false quiet = false hostname = "" omit_hostname = false [[outputs.influxdb]] precision = "s" retention_policy = "default" write_consistency = "any" timeout = "5s" [[inputs.statsd]] service_address = ":8125" delete_gauges = true delete_counters = false delete_sets = false delete_timings = true percentiles = [90] convert_names = true allowed_pending_messages = 10000 percentile_limit = 1000 udp_packet_size = 1500 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|