Tag: awk

awk and tabs in input and output

Why does awk incorrectly detect tab delimited data boundaries (input field separator) The following command will return an empty result instead of the expected third column: echo '1 2 3 4 5 6' | awk -F'\t' '{ print $3 }' In the command, instead of the standard FS (Input field separator), which is a space by default, the -F'\t' option...

How to convert a string to lowercase in Bash

This note will show you how to convert a string to lowercase (small letters) on the Linux command line. To convert a string to lower case regardless of its current case, use one of the following commands. tr echo "Hi all" | tr '[:upper:]' '[:lower:]' hi all Attention! If you want to change the case of any letters other than...

How to convert a string to uppercase in Bash

This note will show you how to convert a string to upper case (capital letters, uppercase) on the Linux command line. To convert a string to capital letters regardless of its current case, use one of the following commands. tr echo "Hi all" | tr '[:lower:]' '[:upper:]' HI ALL Attention! If you want to change the case of any letters...

How to print from specific column to last in Linux command line

In this note, we will consider how to display from a specific column to the last one. For example: how to output from second column to last how to display from third column to last how to display from the fourth column to the last how to output from nth column to last how to display the last column To...

How to remove newline from command output and files on Linux command line

How to remove newline from a string in Bash The following characters are used for line breaks in operating systems: '\n' (newline) '\r' (carriage return) Moreover, \n is used in Linux (also called EOL, End of Line, newline). There may be variations on other operating systems. By default, many programs, Linux command line utilities automatically add the newline character –...
Loading...
X