Skip to content

tech.

How to Create programs, Fix, Find and Configure them

  • Tips&Tricks
  • How to fix
  • For Beginners
  • English
    • Español
    • Deutsch
    • Français
    • 简体中文

Tag: grep

Tips&Tricks

How to count words with grep

Gosh On January 28, 2019January 28, 2019
How to count words with grep

Grep command in Unix/Linux is the short form of ‘global search for the regular expression’. The grep command is a filter that is used to search for lines matching a specified pattern and print the matching lines to standard output. Piping to wc util is slow: ~ $ time grep and tmp/a/longfile.txt | wc -l2811real 0m0.097s userContinue Reading


Tips&Tricks

How to count number of files in directory (Bash)

Gosh On January 27, 2019January 27, 2019
How to count number of files in directory (Bash)

This recipe based on ls output format. When you list a directory, you see file types in the first column. “-” – for a plain file, “d” is for a directory. You can learn more about files in Unix in this article: “File and directory permissions in Linux / FreeBSD / MasOS“. Also we useContinue Reading


Tips&Tricks

How to find a text in files on Linux / Unix in terminal

Gosh On January 26, 2019January 26, 2019
How to find a text in files on Linux / Unix in terminal

You may think, that you should use the “find” utility to … find. But you need the “grep”. grep -rnw ‘/path/to/directory/’ -e ‘pattern’ Where -r is recursive (-R for using symbolic links),-n is line number,-w stands for match the whole word. And it’s pretty common – grep is perfect for searching something in files. And you can use findContinue Reading


Recent Posts

  • How to use/add a self-signed certificate to Mac OS
  • How to delete all Docker images and containers
  • How to change permissions for file / directory recursively in Linux
  • How to install non-free video / audio codecs in Ubuntu
  • Python 3 performance profiling – easiest way

Archives

  • February 2020
  • June 2019
  • January 2019

Categories

  • For Beginners
  • How to fix
  • Tips&Tricks