Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ grep search from files and display the file name     - Java exception handling mechanism (Programming)

- Gitlab installation under CentOS 7 (Linux)

- To create someone else can not afford to delete the administrator user (Linux)

- Vim useful plugin: vundle (Linux)

- Hibernate4 The Hello World (basic environmental structures) (Programming)

- 22 Port weak passwords and SSH connection program of the Linux server (Linux)

- netfilter- in kernel mode network packet operation (Linux)

- CentOS7 iptables (Linux)

- Live Wallpaper for Linux release adds dynamic background (Linux)

- Linux system security configuration Collection (Linux)

- How to choose the correct HTTP status code (Server)

- Redhat 7 can only be read after installation Samba service catalog approach could not be written (Server)

- APR for Tomcat installation under Linux (Server)

- Examples of RAID levels and achieve Operational Details (Linux)

- Keepalived achieve high availability Nginx Reverse Proxy (Server)

- Oracle Database ORA-01555 snapshot too old (Database)

- Java interview questions in nine radio (Programming)

- Git version rollback (Linux)

- How to use systemd timer (Linux)

- Use Epoll develop high-performance application server on Linux (Server)

 
         
  grep search from files and display the file name
     
  Add Date : 2018-11-21      
         
         
         
  How do I search from several files (grep), and displays only the file name to match the file?

When you search from more than one file, it displays the default file name:

grep "word" filename
grep root / etc / *
Sample output:

/etc/bash.bashrc:See"man sudo_root "for details.
/ Etc / crontab: 17 **** root cd / && run-parts --report /etc/cron.hourly
/ Etc / crontab: 256 *** root test-x / usr / sbin / anacron || (cd / && run-parts --report /etc/cron.daily)
/ Etc / crontab: 476 ** 7 root test-x / usr / sbin / anacron || (cd / && run-parts --report /etc/cron.weekly)
/ Etc / crontab: 5261 ** root test-x / usr / sbin / anacron || (cd / && run-parts --report /etc/cron.monthly)
/ Etc / group: root: x: 0:
grep: / etc / gshadow: Permission denied
/etc/logrotate.conf: create 0664 root utmp
/etc/logrotate.conf: create 0660 root utmp
Each line starting with the first part of the file name (eg: / etc / crontab, / etc / group). Use the -l option to display only the file name:

grep-l "string" filename
grep-l root / etc / *
Sample output:

/ Etc / aliases
/etc/arpwatch.conf
grep: /etc/at.deny: Permission denied
/etc/bash.bashrc
/ Etc / bash_completion
/etc/ca-certificates.conf
/ Etc / crontab
/ Etc / group
You can also reverse the output; using the -L option to output the name of a file that does not match:

grep-L "word" filename
grep-L root / etc / *
Sample output:

/ Etc / apm
/ Etc / apparmor
/etc/apparmor.d
/ Etc / apport
/ Etc / apt
/ Etc / avahi
/etc/bash_completion.d
/etc/bindresvport.blacklist
/etc/blkid.conf
/ Etc / bluetooth
/etc/bogofilter.cf
/ Etc / bonobo-activation
/etc/brlapi.key
     
         
         
         
  More:      
 
- Binary tree traversal recursive and non-recursive (cyclic) traversal achieve (Programming)
- Recent Consolidation Using Linux security module (Linux)
- To setup a ftp server under Linux (Server)
- Ubuntu uses the / etc / profile file to configure the JAVA environment variable (Linux)
- PHP security Programming Advice (Programming)
- C language print various graphic (Programming)
- Linux operating system to solve a serious fault handling (Linux)
- How to install or upgrade to the Linux kernel in Ubuntu 4.2 (Linux)
- Let your PHP 7 faster the Hugepage (Linux)
- Linux shell in back quotes (`) Application (Linux)
- An example of troubleshooting of embedded Linux OpenWRT (Linux)
- RedHat command line and graphical interface switching (Linux)
- Installation on Ubuntu class Winamp audio player Qmmp 0.9.0 (Linux)
- Learning how to teach safety system to prevent your own IP leakage (Linux)
- How to configure Apache Solr on Ubuntu 14/15 (Server)
- Linux serial port driver test (Linux)
- Ubuntu 15.04 installation Powercommands 2.0 (Linux)
- count (*) function in MySQL optimization of InnoDB storage engine (Database)
- To use iostat display I / O status under Linux (Linux)
- Protection Docker container Notice (Server)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.