Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ grep search from files and display the file name     - There is sort of a directed acyclic graph topology (Programming)

- Automatic Clear date directory shell script (Linux)

- Lua non-blocking write log (Programming)

- Oracle Bug caused by the collection of AWR Snapshot fault (Database)

- Different versions of MongoDB achieve master-slave replication (Database)

- Seven kinds of NIC binding mode Detail (Linux)

- CentOS install expect (Linux)

- Oracle 10g relations with the constraint of column properties NULLABLE (Database)

- MySQL how to export files with the date format (Database)

- CentOS7 install NTFS-3G driver (Linux)

- Android Scroller call mechanism and the relationship of computeScroll (Programming)

- Linux security configuration (Linux)

- Oracle database file path changes (Database)

- Selection sort, insertion sort, and Shell sort (Programming)

- Linux System Getting Started Learning: Linux how to install 7zip (Linux)

- C # and JavaScript arrays to re-summary (Programming)

- Linux operating system, the internal and external security overview (Linux)

- JavaScript function closures Quick Start (Programming)

- Create the container and run the application Docker (Server)

- Linux 6 use UDEV binding shared storage (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
grep: /etc/at.deny: Permission denied
/ Etc / bash_completion
/ 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 / apport
/ Etc / apt
/ Etc / avahi
/ Etc / bluetooth
/ Etc / bonobo-activation
- Install Java, Maven, Tomcat under Linux (Linux)
- Getting Started with Linux: CentOS7 Install Mono with the yum command (Server)
- Using Libreoffice under ubuntu (Linux)
- How to install GIMP 2.8.16 in Ubuntu 16.04,15.10,14.04 (Linux)
- Use Python automatically cleared Android Engineering excess resources (Programming)
- To create a file in Linux directory by setfacl (Linux)
- Java proxy mode (Programming)
- Android project and coding specifications (Programming)
- Linux system started to learn: Teaches you install Ubuntu 15.04 on VirtualBox (Linux)
- Linux security settings Basics (Linux)
- CentOS / Linux restart active NIC connection paths / network configure error Error Resolution (Linux)
- To restore the last time applications running when Ubuntu user log in again (Linux)
- Ubuntu / openSUSE users to install Veusz 1.21.1 (Linux)
- Linux script to copy the folder to all folders with the same name (Linux)
- Ubuntu Thunderbird 24.4.0 (Linux)
- Actual SSH port forwarding (Linux)
- DRBD Principle and Features Overview (Server)
- Teach you how to protect the security of Linux desktop (Linux)
- APF firewall installation and configuration under Linux (Linux)
- Use pg_basebackup build PostgreSQL streaming replication environment (Database)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.