Open jbeadling opened 1 year ago
sed is short stream editor, its a powerful command-line utility for text manipulations. It's often used for performing find-and-replace operations, text substitution, and basic text transformations.
In the below example I use sed on a small text file to replace the word 'art' for the word 'fart'. I also ignore case sensitive letters.
awk is a text-processing tool that allows you to perform various text manipulation tasks, such as searching for patterns, extracting specific columns, performing calculations, and more. It is commonly used on CSV files.
In the below example I have a small file with snacks and their prices listed. I use the awk tool to separate the prices into their own column.
Below is a script that takes a csv file (personel.csv) and converts the commas into tabs and then prints out the contents in neat columns to make it more readable. The script uses awk & sed together.
Summary
Learn to use
sed
andawk
for text manipulation. These powerful utilities allow you to parse, transform, and manipulate text data from the command line and are particularly useful for scripting and data analysis.Description
Objective: Understand the capabilities of
sed
andawk
for text manipulation tasks and become proficient in their usage.Scope:
sed
awk
sed
awk
Learning Tasks
Introduction to
sed
:sed
(Stream Editor) is and what kind of text manipulation tasks it can perform.Introduction to
awk
:awk
is and how it can be used for pattern scanning and processing in text files.Text Manipulation Tasks Using
sed
:sed.
Text Manipulation Tasks Using
awk
:awk,
such as text filtering, field extraction, and calculations.Hands-on Practice:
sed
to replace all instances of a word in a text file.awk
to print specific fields from a delimited text file.sed
andawk
in a pipeline for more complex text manipulation.sed
andawk
to automate a particular text manipulation task.Troubleshooting:
sed
andawk
and how to resolve them.Learning Goals
sed
andawk.
sed
for stream editing tasks.awk
for text processing and data extraction.Priority