Bash Tutorials

This page lists every Bash tutorial on Collecting Wisdom.

Bash: How to Replace Text in String
Bash: How to Replace Special Characters in String
Bash: How to Replace Multiple Characters in String
Bash: How to Replace Specific Line in File
Bash: How to Replace Newline with Comma
Bash: How to Replace Space with Underscore
Bash: How to Replace Dash with Underscore
Bash: How to Rename Extension of Multiple Files
Bash: How to Replace All Occurrences of String in File
Bash: How to Read CSV File and Skip First Line
Bash: How to Read Columns from CSV File into Arrays
Bash: How to Extract Specific Columns from CSV File
Bash: How to Extract Text Between Two Strings
Bash: How to Extract Date from String
Bash: How to Extract Substring After Specific Character
Bash: How to Extract Substring Before Specific Character
Bash: How to Get Month Name
Bash: How to Get Day of Week
Bash: How to Delete Duplicate Lines in File
Bash: How to Delete All Files in Directory
Bash: How to Delete All Empty Lines in File
Bash: How to List All Files in Folder by Size
Bash: How to List All Files in Folder Without Extension
Bash: How to List All Files Matching a Specific Pattern
Bash: How to List All Files in Folder by Date
Bash: How to Count Number of Unique Lines in File
Bash: How to Count Number of Characters in String
Bash: How to Count Number of Columns in File
Bash: How to Count Number of Words in String
Bash: How to Count Number of Files Matching a Pattern
Bash: How to Count Number of Blank Lines in File
Bash: How to Calculate Frequency of Each Word in File
Bash: How to Calculate the Average of a Column
Bash: How to Check if String Starts with Specific Value
Bash: How to Check if String Ends with Specific Value
Bash: How to Check if File is Empty
Bash: How to Check if File Contains Specific String
Bash: How to Compare Two Files
Bash: How to Compare Dates
Bash: How to Calculate Date Difference
Bash: How to Convert Epoch to Date
Bash: How to Use ‘cut’ with Multiple Spaces
Bash: How to Find Duplicate Lines in File
Bash: How to Sort by Specific Column in File
Bash: How to Sort File by Multiple Columns
Bash: How to Sort by Last Column in File
Bash: How to Sort a File by Line Length
Bash: How to Sort Lines in File and Ignore First Line
Bash: How to Extract First Number from a String
Bash: How to Get First N Characters from String
Bash: How to Get Last N Characters from String
Bash: How to Split a String Using Multiple Delimiters
Bash: How to Split Text File into Multiple Files
Bash: Split File into Multiple Files Based on Column Value
Bash: How to Generate Random Number in Range
Bash: How to Generate a Sequence of Numbers
Bash: How to Copy All Files in Directory to Another Directory
Bash: How to Copy Multiple Specific Files from One Folder to Another
Bash: How to Copy and Rename a File
Bash: How to Get First Word of a String
Bash: How to Get Last Word of a String
Bash: How to Get the Last Line of a File
Bash: How to Convert String to Integer
Bash: How to Convert String to Date
Bash: How to Convert Timestamp to Date
Bash: How to Read Lines of File into Array
Bash: How to Slice an Array
Bash: How to Remove newline from String
Bash: How to Remove Last Character from String
Bash: How to Remove Spaces from String
Bash: How to Remove Leading Zeros from a Variable
Bash: How to Remove Specific Columns from a File
Bash: How to Remove All Whitespaces from File
Bash: How to Remove Only Double Empty Lines in File
Bash: How to Remove First Word from Each Line in File
Bash: How to Remove First and Last Characters from String
Bash: How to Escape Dollar Signs
Bash: How to Filter CSV File Based on Column Value
Bash: How to Filter for Lines in File that Start with Specific String
Bash: How to Filter for Rows where Column is Not Empty
Bash: How to Use find -exec with grep
Bash: How to Use find Command and Exclude Specific Directory
Bash: How to Find All Files with Specific Extension
Bash: How to Find All Empty Directories
Bash: How to Use Echo to Output a Multi-line String
Bash: How to Echo All Values in an Array
Bash: How to Replace Patterns Using Regex
Bash: How to Use Regex with “OR” to Match Multiple Patterns
Bash: How to Use Regex to Match Digits
Bash: How to Append Values to Array
Bash: How to Concatenate Multiple Files into One File
Bash: How to Merge Multiple CSV Files into One File
Bash: How to Swap Two Columns in a File

sed

The sed stream editor can be used to perform various operations on text streams and files. Below is a list of each sed tutorial available on Collecting Wisdom:

How to Use sed to Replace newline with Comma
How to Use sed to Replace newline with space
How to Use sed to Replace All Occurrences of Pattern
How to Use sed to Replace All Text Before Match
How to Use sed to Replace All Text After Match
How to Use sed to Replace Only the First Occurrence in a File
How to Use sed to Replace Last Occurrence of Character in String
How to Use sed to Replace Tab Characters
How to Use sed to Replace Path with Another Path
How to Use sed to Replace First Line in a File
How to Use sed to Replace All Backslashes with Forward Slashes
How to Use sed to Replace Multiple Strings
How to Use sed to Replace Multiple Spaces with Single Space
How to Use sed to Replace Multiple Empty Lines with One Empty Line
How to Use sed to Replace String Between Two Patterns
How to Use sed to Replace Spaces with Commas
How to Use sed to Replace Last Line Matching Pattern
How to Use sed to Replace nth Occurrence of Pattern
How to Use sed to Replace Exact Match
How to Use sed to Replace Brackets
How to Use OR Operator in sed Regex
How to Use Case-Insensitive Search and Replace in sed
How to Use sed to Extract All Lines Containing a Pattern
How to Use sed to Extract Numbers from a String
How to Use sed to Delete All Lines Containing Specific String
How to Use sed to Delete All Empty Lines in File
How to Use sed to Delete Specific Line Numbers from File
How to Use sed to Delete First n Lines of File
How to Use sed to Delete Last n Lines of File
How to Use sed to Delete All Lines Starting with Specific Pattern
How to Use sed to Delete All Lines that Do Not Match Pattern
How to Use sed to Delete n Lines Following a Pattern
How to Use sed to Delete All Lines After Match
How to Use sed to Remove all Double Quotes from File
How to Use sed to Remove First n Characters of Line
How to Use sed to Remove Last n Characters of Line
How to Use sed to Remove a Substring
How to Use sed to Remove Trailing Whitespaces in File
How to Use sed to Remove the Last Character of a File
How to Use sed to Remove Leading Whitespaces in File
How to Use sed to Remove Trailing newlines from File
How to Use sed to Remove Non-Alphanumeric Characters
How to Use sed to Remove Every Other Line in File
How to Use sed to Insert a Line After Match
How to Use sed to Insert a Tab
How to Use sed to Insert Line at Specific Line Number
How to Use sed to Insert Line at Top of File
How to Use sed to Insert Multiple Lines After Match
How to Use sed to Insert Character at Beginning of Lines in File
How to Use sed to Insert Line with Leading Spaces
How to Use sed to Insert String After Every N Lines
How to Use sed to Split String Based on Delimiter
How to Use sed to Convert All Characters to Lowercase
How to Use sed to Convert First Letter of Word to Uppercase
How to Use sed to Print Out Line Numbers
How to Use sed to Print Specific Lines in File
How to Use sed to Print Every nth Line of File
How to Use sed to Print All Lines Between Two Patterns
How to Use sed to Print All Lines After Line with Match
How to Use sed to Print First n Characters of Line
How to Use sed to Apply Changes to Multiple Files
How to Use sed to Append Line to End of a File
How to Use sed to Append Text at End of Each Line
How to Use sed to Append Text to End of Each Line Matching Pattern
How to Use sed to Add Comma to End of Every Line in File
How to Use sed to Insert Empty Line in a File
How to Use sed to Insert Character at Specific Position
How to Use sed to Merge Every Two Lines in File
How to Escape Single Quotes in sed
How to Use sed to Rename Multiple Files
How to Use sed to Convert Multiple Lines into Comma Separated Line
How to Use sed to Comment Out Lines that Match Pattern
How to Use sed to Uncomment Lines Containing Pattern

awk

In Linux, awk is a scripting language that can be used to modify files in a variety of ways. Below is a list of each awk tutorial available on Collecting Wisdom:

How to Use awk to Replace newline with Space
How to Use awk to Replace All Occurrences of String in File
How to Use awk to Extract Substring
How to Use awk to Extract Specific Columns from File
How to Use Multiple Delimiters in awk
How to Use awk to Print First Column of File
How to Use awk to Print Last Column of File
How to Use awk to Print a Range of Columns
How to Use awk to Print All Fields Except First Field
How to Use awk to Print Last Line of a File
How to Use awk to Print Double Quotes in Output
How to Use awk to Print Rows Where Column Equals Value
How to Use awk to Print All Columns After Specific Number
How to Use awk to Print Out Line Numbers
How to Use awk to Sum the Values in a Column
How to Use awk to Group by and Sum Column Values
How to Use awk to Count Number of Occurrences of Word
How to Use awk to Count Unique Values in Column
How to Skip First Line in awk
How to Skip Empty Lines When Using awk
How to Use awk to Delete All Lines Matching a Pattern

grep

The grep command in Linux is used for searching and matching text patterns in files. Below is a list of each grep tutorial available on Collecting Wisdom:

How to Use grep to Get Line Number of Match
How to Use grep to List All Files Containing Specific String
How to Use grep to Extract URL from File
How to Use grep to Extract IP Addresses from File
How to Use grep to Extract Last Occurrence in File
How to Use grep with Case-Insensitive Matching
How to Use grep to Count All Occurrences of String per File
How to Use grep and Exclude Specific Directories
How to Use grep and Exclude Specific Files
How to Exclude a Pattern with grep
How to Exclude Multiple Patterns with grep
How to Use grep and Only Print Matching Pattern
How to Use grep to Only Print Second Match
How to Use grep to Find Lines that Exceed Certain Length