Parsing

HowTo : Find The Length Of a String or Variable in Bash

This short note shows how to find out the length of a string from the Linux command line, how to count the lengths of each line in a file and how to get the length of a string stored in a variable in Bash and then assign that calculated number of characters to another variable.

RegEx : Find IP Addresses in a File Using Grep

Validate IP addresses with regular expressions and extract all matched IP addresses from a file with grep.

Add Character to the Beginning or to the End of Each Line using AWK and SED

From the following article, you'll learn how to add characters to the beginning or to the end of each line in Bash.

It's very easy to append any text, like prefix or suffix, before and after each line, using such Linux command-line editors like SED or AWK.

RegEx : Find Email Addresses in a File using Grep

Here is a best regular expression that will help you to perform a validation and to extract all matched email addresses from a file.

This regular expression matches 99% of the email addresses in use nowadays.

In this article you'll find a regular expression itself and an example of how to extract matched email addresses from a file with the grep command.

Removing First and Last Characters From Strings in Bash

From the following article, you'll learn how to remove first characters from the beginning of each line in Bash and how to print strings between first and last characters using cut command.

You'll also learn how to remove last characters of each line using trick with reverse command.

Printing Specific Columns (Fields) in Bash using AWK

AWK is a powerful command line tool, that can be used to process the input data as columns.

With the examples from the following article you will be able to solve such common tasks as :

  • Print Columns by Number
  • Change Field Separator
  • Exclude Specific Columns
  • Print or Exclude a Range of Columns

Using BASH "Grep OR / Grep AND / Grep NOT" Operators

How to use OR / AND / NOT operators with Linux GREP / SED / AWK commands in examples. How to find all lines, that contain any of the several patterns and how to print all lines in a file, that match multiple patterns. How to find and print all lines, that do not match a pattern.

Pages