Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ grep search from files and display the file name     - CentOS7 boot systemd introduction and use of management (Linux)

- MySQL bulk insert data script (Database)

- Hanoi problem Java Solution (Programming)

- OpenVPN offsite interconnecting room availability and load balancing solution (Server)

- Linux platform NTOP Installation and Configuration (Linux)

- About MongoDB query method according to fuzzy field (Database)

- Linux Getting Started tutorial: hard disk partition and to deal with traps (Linux)

- Windows SmartGit installation (Linux)

- LNMP summary of the issues common 502 Bad Gateway (Server)

- Nginx + Tomcat static and dynamic load balancing and separation configuration essentials under Linux (Server)

- How to Install Sticky Notes on Ubuntu and Derivatives (Linux)

- On event processing browser compatibility notes (Programming)

- Lua non-blocking write log (Programming)

- Linux, Firefox unloading and installation and upgrade (Linux)

- Simple to use multi-threaded programming under Linux mutex and condition variable (Programming)

- Enterprise Hadoop cluster architecture - NFS installation (Server)

- How Oracle implements random reads from specific combinations (Database)

- Linux gprof oprofiling and performance testing tools (Linux)

- C / C ++ language variable scope: local variables, global variables, file-level variables (Programming)

- Linux System Getting Started Tutorial: Linux file permissions brief description (Linux)

 
         
  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:      
 
- Ubuntu install virtual machine software VirtualBox 4.3.10 (Linux)
- About redis in Replication (Database)
- CentOS install pip (Linux)
- MySQL 5.6 Open full query log (Database)
- stat Usage: Get permission to file the corresponding figures (Linux)
- Use Python automatically cleared Android Engineering excess resources (Programming)
- Graphing tool: Gnuplot (Linux)
- Django1.8 return json json string and the string contents of the received post (Programming)
- Forgot Linux root password (Linux)
- RAID disk array Description (Linux)
- Partition contrast manifestations under Windows and Linux (Linux)
- Nonstandard IMP-00010 error processing one case (Database)
- Redis Design and Implementation study notes (Database)
- To achieve a two-way static NAT stateless available modules on Linux (Linux)
- Oracle 12c of the auto-increment Identity Columns (Database)
- Upgrade to Node V4 seven reasons (Programming)
- Fedora 22 how to play rmvb mp4 mkv video files (Linux)
- MySQL to manage multiple instances of method (Database)
- CentOS 7.0 Close firewall is enabled by default iptables firewall (Linux)
- Linux boot process and run level (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.