ShellHacks
Command-Line Tips and Tricks

text-processing

  • Blog

Grep OR – Grep AND – Grep NOT – Match Multiple Patterns

Posted on December 27, 2016March 19, 2017by admin

The grep, egrep, sed and awk are the most common Linux command line tools for parsing files. From the following article you’ll learn how to match multiple patterns with the OR, AND, NOT operators, using grep, egrep, sed and awk commands from the Linux command line. I’ll show the examples of how to find the […]

Read More
5 Comments
  • Blog

Using SED and AWK to Print Lines Between Two Patterns

Posted on December 27, 2016February 24, 2017by admin

From the following article, you’ll learn how to print lines between two patterns in bash. I’ll show how to to extract and print strings between two patterns using sed and awk commands. I’ve created a file with the following text. It’ll be used in the examples below, to print text between strings with patterns. I […]

Read More
17 Comments
  • Blog

HowTo: View a Config File Without Comments

Posted on December 27, 2016February 24, 2017by admin

With the help of ‘grep’ command it is quite easy just to look at the active setting of configuration files, omitting comments. The following command will display the content of the file ‘somefile.conf’, omitting blank lines and the lines started with “#”: $ grep ^[^#] somefile.conf Also, you can pipe the output to a new […]

Read More
No comments yet
  • Blog

HowTo: Remove Blank Lines From a File

Posted on December 27, 2016February 24, 2017by admin

Use one of the following commands to remove blank lines from a file. 1. Using the grep command: $ grep -v “^$” file.txt 2. Using the sed command: $ sed ‘/^$/d’ file.txt 3. Using the awk command: $ awk ‘/./’ file.txt 4. Using the tr command: $ tr -s ‘\n’ < file.txt You also can […]

Read More
No comments yet

Posts navigation

Newer posts

Online Tools

  • Base64 Decode
  • Base64 Encode

Tags

access-control anonymity ansible apache archive arduino artifactory bash boot cmd command-line curl dns docker encryption git gitlab helm java jenkins kubernetes linux macos mail mongodb mysql network openssl pdf php powershell prometheus python raspberry pi ssh sublime text systemd telegram telnet text-processing tor tsm windows wordpress yum
  • Telegram
  • Twitter
  • RSS
Privacy
Copyright © 2011-2023 | www.ShellHacks.com