Fun working with files using awk and sed

awk

awk '/mtllib/' test.txt
awk '/mtllib/ {print NR, $1, $2}' test.txt
awk 'NR==5 {print}' test.txt
awk 'END {print NR}'
awk '{print $3}' f1.txt | sort -u > out1
awk '{print $2}' f2.txt | sort -u > out2
diff out1 out2

sed

sed -n '3,6 p' test.txt
sed -i 's|Old|New|' test.txt
sed -i 's|2/.|2|g' test.txt
sed -i '/debian/d' file
sed -i '1isome text' test.txt

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Amazon Web Services (AWS) Basics Part 1 — Cloud Computing

Top Hospital Management Software for healthcare industry in 2020

Radio Button for iOS in Swift

Why we opted for React Native over Flutter

How to runs GUI Application in Docker?

Legacy Modernization | Time to reinvent the Wheel

Head First Java- Chapter 1

What is Nametag?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Privalov Vladimir

Privalov Vladimir

More from Medium

Creating a GDB pretty printer from scratch

Running SQL Server in Linux containers on Windows using Docker Compose

SSMS

Environment Variables and Python command not found

AlterNET Studio 8.0 released — now with support for Visual Studio 2022 and .NET 6