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

- Deep understanding of C # generics (Programming)

- Windows 7 hard disk to install Ubuntu 14.10 (Linux)

- Ubuntu is not in the sudoers file problem solving (Linux)

- grep command usage (Linux)

- Oracle () trunc function usage (Database)

- Linux package manager - yum (Linux)

- Use MD5 transform algorithm to prevent exhaustive decipher passwords (Linux)

- Ubuntu uses conky add desktop control (Linux)

- Oracle 11g em start newspaper site's security certificate has a solution to the problem (Database)

- tar command to extract a file error: stdin has more than one entry (Linux)

- Add local search to your Android app (Programming)

- Command filter MySQL slow query log (Database)

- Linux system performance analysis and top command ps.pstree Comments (Linux)

- Retro terminal in Linux (Linux)

- SpringMVC the use of interceptors (Programming)

- The several technical presentation Raid under Linux (Linux)

- Kickstart automated installation and deployment RHEL 7.0 (Linux)

- The Java development environment to build under Ubuntu 14.04 (Linux)

- Compile and install Memcached can not find GCC (Programming)

 
         
  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:      
 
- CentOS 6 Install Xen4.2 Virtualization Practice (Linux)
- MySQL binlog group to submit XA (two-phase commit) (Database)
- Number JavaScript type system (Programming)
- Openfire Hazelcast cluster Detailed (Server)
- CentOS Linux build SVN server (Server)
- Fedora 20 users install the Mate 1.8 desktop (Linux)
- Oracle SQL statement tracking (Database)
- How to build Memcached Docker container (Server)
- The Linux-based security settings Ipchains Firewall (Linux)
- curl Usage: Being the first site header and status codes (Server)
- pureftpd basis: Install, configure, implement, anonymous logon (Linux)
- High-performance JavaScript DOM programming (Programming)
- Java development specifications summary (Programming)
- OpenSUSE 13.1 OpenSUSE 12.3 and how to install Cinnamon 2.2 Desktop (Linux)
- Talk about the Linux folder permissions issue again (Linux)
- Chromium Install Flash Official Guide (Linux)
- Redis is installed in Ubuntu 14.04 (Database)
- Use Android Studio and Gradle packaged multi-version APK (Programming)
- shellinabox: one uses AJAX Web-based terminal emulator (Linux)
- Xtrabackup creates a slave node without downtime (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.