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

Install Nvidia Driver in Ubuntu/Kali Linux(2021)

Working around TURN bugs

N.O.W w/ Mark11 and DKD

Kaiken Inu Meme Token

Get Started With SRS.vc to Explore Global Hackathons

Creating a Pressure Pad

Grpc service in go on docker.

Assembly of Tumbller robot

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

Getting Started with Linux Command Line Basics

Config ip Address interface Linux

How To Find Linux System Installation Date

Command Line Essentials