SlideShare a Scribd company logo
AWK LANGUAGE
-AWK Scripts-
What are we going to talk?
01 What is AWK?
02 Why should we learn Scripting?
03 How AWK Scripts works?
04 How to write and execute scripts in AWK?
What is AWK?
-History and content-
AWK Language
Alfred Aho, Peter Weinberger, Brian Kernighan
Authors
Interpreted programming language/ Very powerful / specially designed for text processing
Variants of AWK
AWK - Original AWK from AT & T Laboratory.
NAWK - Newer and improved version of AWK from AT & T Laboratory.
GAWK - GNU AWK. All GNU/Linux distributions ship GAWK. fully compatible with AWK and NAWK.
AWK Language
More about AWK…………..
✓ Command/tool available in all the Linux/Unix flavors
✓ Perform activities
▪ processing text files(filtering, manipulation etc.)
▪ Reporting
✓ Consist of,
Arithmetic operations
Binary operations,
conditions
loops, functions
Programming Language
“Awk the Swiss army knife of the
Unix toolkit”.
Why should we learn
Scripting?
-script vs. program-
Script vs. program
Script - Scripting Language Program - Programming Language
script is interpreted Program is executed
set of rules to control another software
application
a. converts code line by line
b. slower/less memory needed
c. errors displayed for every line
Set of instructions to perform a certain
task
a. converts whole code at a time
b. Faster/more memory needed
c. errors displayed after checking whole
program
https://www.youtube.com/watch?v=XgPrF3GOSMw
What can we do with AWK?
❖ Manage small, personal databases
❖ Generate reports
❖ Validate data
❖ Produce indexes
❖ Perform document preparation tasks
❖ Experiment with algorithms (that can be adapted later
to other computer languages)
How AWK Scripts works?
-Procedure-
How AWK works?
Works line by line
-horizontal manner, reading one line after the other-
Treats a file as group of columns
-assign data to columns depending on the field separator-
$1, $2, $3,………. : Assigned column numbers
NF(Number of Fields): Last column number(built-in-variable)
Different
Conditions
Columns Desired OutputApply
on
Get
How to write and execute
scripts in AWK?
-Syntaxes and Examples-
How to Write?
o Awk scripts start with the line: #! /path/to/awk/utility –f
E.g.If Awk utility is located in /usr/bin/awk then start line will be #! /usr/bin/awk -f
#! /usr/bin/awk -f
Interpreter Interpreter option
(to read file)
Specifies
Interpreter
Start
How to Write?
Rule in a script pattern { action }
/aaronkilik/ { print "Username :",$1,"User ID :",$3,"User GID :",$4 }
Save Script_Name.awk
How to Execute?
Change Privileges chmod +x Script_Name.awk
Execute ./Script_Name.awk [input_files]
E.g.: chmod +x first.awk
E.g.: ./first.awk /etc/mydirect
Examples
BEGIN {
print "Users and their corresponding home"
print " Username t HomePath"
print "___________ t __________"
FS=":"
}
{
print $1 " t " $6
}
END {
print "The end"
}
Field Separator
Output Separator
record which is processed.
count of processed
records.
Format Specifier
Thank you
K.K.Layani Malsha
https://infotecinformation.wordpress.com/

More Related Content

What's hot

【ジュニパーサロン】Contrailの進化 Contrail Enterprise Multicloudとは ~Contrailを知っている人も知らない人...
【ジュニパーサロン】Contrailの進化 Contrail Enterprise Multicloudとは ~Contrailを知っている人も知らない人...【ジュニパーサロン】Contrailの進化 Contrail Enterprise Multicloudとは ~Contrailを知っている人も知らない人...
【ジュニパーサロン】Contrailの進化 Contrail Enterprise Multicloudとは ~Contrailを知っている人も知らない人...
Juniper Networks (日本)
 
Architecture mvc
Architecture mvcArchitecture mvc
Architecture mvcMadridal
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
Jemin Patel
 
KSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for KafkaKSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for Kafka
confluent
 
Architectures n-tiers
Architectures n-tiersArchitectures n-tiers
Architectures n-tiers
Heithem Abbes
 
Workshop Spring - Session 1 - L'offre Spring et les bases
Workshop Spring  - Session 1 - L'offre Spring et les basesWorkshop Spring  - Session 1 - L'offre Spring et les bases
Workshop Spring - Session 1 - L'offre Spring et les bases
Antoine Rey
 
Chp3 - Les Services Web
Chp3 - Les Services WebChp3 - Les Services Web
Chp3 - Les Services Web
Lilia Sfaxi
 
L Architecture Logicielle En Pratique
L Architecture Logicielle En PratiqueL Architecture Logicielle En Pratique
L Architecture Logicielle En Pratique
François Trudel
 
Cours architecture
Cours architectureCours architecture
Cours architecture
Abdelaziz Elbaze
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
AIMDek Technologies
 
Chap1 clientsrvr
Chap1 clientsrvrChap1 clientsrvr
Chap1 clientsrvr
Rachid Lajouad
 
[Webinar]: Working with Reactive Spring
[Webinar]: Working with Reactive Spring[Webinar]: Working with Reactive Spring
[Webinar]: Working with Reactive Spring
Knoldus Inc.
 
eServices-Tp1: Web Services
eServices-Tp1: Web ServiceseServices-Tp1: Web Services
eServices-Tp1: Web Services
Lilia Sfaxi
 
ACI Hands-on Lab
ACI Hands-on LabACI Hands-on Lab
ACI Hands-on Lab
Cisco Canada
 
2009.10.28 現場で役立つ oracle dbのパフォーマンスチューニング
2009.10.28 現場で役立つ oracle dbのパフォーマンスチューニング2009.10.28 現場で役立つ oracle dbのパフォーマンスチューニング
2009.10.28 現場で役立つ oracle dbのパフォーマンスチューニングkouji_s_0808
 
IPsec
IPsecIPsec
Understanding Cisco’s Next Generation SD-WAN Solution with Viptela
Understanding Cisco’s Next Generation SD-WAN Solution with ViptelaUnderstanding Cisco’s Next Generation SD-WAN Solution with Viptela
Understanding Cisco’s Next Generation SD-WAN Solution with Viptela
Cisco Canada
 
What is gRPC introduction gRPC Explained
What is gRPC introduction gRPC ExplainedWhat is gRPC introduction gRPC Explained
What is gRPC introduction gRPC Explained
jeetendra mandal
 
Soa
SoaSoa

What's hot (20)

【ジュニパーサロン】Contrailの進化 Contrail Enterprise Multicloudとは ~Contrailを知っている人も知らない人...
【ジュニパーサロン】Contrailの進化 Contrail Enterprise Multicloudとは ~Contrailを知っている人も知らない人...【ジュニパーサロン】Contrailの進化 Contrail Enterprise Multicloudとは ~Contrailを知っている人も知らない人...
【ジュニパーサロン】Contrailの進化 Contrail Enterprise Multicloudとは ~Contrailを知っている人も知らない人...
 
Architecture mvc
Architecture mvcArchitecture mvc
Architecture mvc
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
KSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for KafkaKSQL: Streaming SQL for Kafka
KSQL: Streaming SQL for Kafka
 
Architectures n-tiers
Architectures n-tiersArchitectures n-tiers
Architectures n-tiers
 
Workshop Spring - Session 1 - L'offre Spring et les bases
Workshop Spring  - Session 1 - L'offre Spring et les basesWorkshop Spring  - Session 1 - L'offre Spring et les bases
Workshop Spring - Session 1 - L'offre Spring et les bases
 
Chp3 - Les Services Web
Chp3 - Les Services WebChp3 - Les Services Web
Chp3 - Les Services Web
 
L Architecture Logicielle En Pratique
L Architecture Logicielle En PratiqueL Architecture Logicielle En Pratique
L Architecture Logicielle En Pratique
 
Kafka basics
Kafka basicsKafka basics
Kafka basics
 
Cours architecture
Cours architectureCours architecture
Cours architecture
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Chap1 clientsrvr
Chap1 clientsrvrChap1 clientsrvr
Chap1 clientsrvr
 
[Webinar]: Working with Reactive Spring
[Webinar]: Working with Reactive Spring[Webinar]: Working with Reactive Spring
[Webinar]: Working with Reactive Spring
 
eServices-Tp1: Web Services
eServices-Tp1: Web ServiceseServices-Tp1: Web Services
eServices-Tp1: Web Services
 
ACI Hands-on Lab
ACI Hands-on LabACI Hands-on Lab
ACI Hands-on Lab
 
2009.10.28 現場で役立つ oracle dbのパフォーマンスチューニング
2009.10.28 現場で役立つ oracle dbのパフォーマンスチューニング2009.10.28 現場で役立つ oracle dbのパフォーマンスチューニング
2009.10.28 現場で役立つ oracle dbのパフォーマンスチューニング
 
IPsec
IPsecIPsec
IPsec
 
Understanding Cisco’s Next Generation SD-WAN Solution with Viptela
Understanding Cisco’s Next Generation SD-WAN Solution with ViptelaUnderstanding Cisco’s Next Generation SD-WAN Solution with Viptela
Understanding Cisco’s Next Generation SD-WAN Solution with Viptela
 
What is gRPC introduction gRPC Explained
What is gRPC introduction gRPC ExplainedWhat is gRPC introduction gRPC Explained
What is gRPC introduction gRPC Explained
 
Soa
SoaSoa
Soa
 

Similar to Awk

awk_intro.ppt
awk_intro.pptawk_intro.ppt
awk_intro.ppt
PrasadReddy710753
 
Presentation of awk
Presentation of awkPresentation of awk
Presentation of awk
yogesh4589
 
vb script
vb scriptvb script
vb script
Anand Dhana
 
Introduction to AWK utility on unix.pptx
Introduction to AWK utility on unix.pptxIntroduction to AWK utility on unix.pptx
Introduction to AWK utility on unix.pptx
abuadu
 
Flink Forward Berlin 2018: Robert Bradshaw & Maximilian Michels - "Universal ...
Flink Forward Berlin 2018: Robert Bradshaw & Maximilian Michels - "Universal ...Flink Forward Berlin 2018: Robert Bradshaw & Maximilian Michels - "Universal ...
Flink Forward Berlin 2018: Robert Bradshaw & Maximilian Michels - "Universal ...
Flink Forward
 
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry
confluent
 
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
Athens Big Data
 
The Archaeological Recording Kit: An open source solution to project recording
The Archaeological Recording Kit: An open source solution to project recordingThe Archaeological Recording Kit: An open source solution to project recording
The Archaeological Recording Kit: An open source solution to project recording
Jessica Ogden
 
What's New in Spark 2?
What's New in Spark 2?What's New in Spark 2?
What's New in Spark 2?
Eyal Ben Ivri
 
FireWorks workflow software
FireWorks workflow softwareFireWorks workflow software
FireWorks workflow software
Anubhav Jain
 
Awx
AwxAwx
Compiler Construction | Lecture 1 | What is a compiler?
Compiler Construction | Lecture 1 | What is a compiler?Compiler Construction | Lecture 1 | What is a compiler?
Compiler Construction | Lecture 1 | What is a compiler?
Eelco Visser
 
Java Course 1: Introduction
Java Course 1: IntroductionJava Course 1: Introduction
Java Course 1: Introduction
Anton Keks
 
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10 an integration story
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10  an integration story[Spark Summit EU 2017] Apache spark streaming + kafka 0.10  an integration story
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10 an integration story
Joan Viladrosa Riera
 
Apache Spark Streaming + Kafka 0.10 with Joan Viladrosariera
Apache Spark Streaming + Kafka 0.10 with Joan ViladrosarieraApache Spark Streaming + Kafka 0.10 with Joan Viladrosariera
Apache Spark Streaming + Kafka 0.10 with Joan Viladrosariera
Spark Summit
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
Rebaz Najeeb
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming languageVasavi College of Engg
 
Amazon Elastic Beanstalk
Amazon Elastic BeanstalkAmazon Elastic Beanstalk
Amazon Elastic BeanstalkEberhard Wolff
 
Realizing the promise of portable data processing with Apache Beam
Realizing the promise of portable data processing with Apache BeamRealizing the promise of portable data processing with Apache Beam
Realizing the promise of portable data processing with Apache Beam
DataWorks Summit
 

Similar to Awk (20)

awk_intro.ppt
awk_intro.pptawk_intro.ppt
awk_intro.ppt
 
Presentation of awk
Presentation of awkPresentation of awk
Presentation of awk
 
vb script
vb scriptvb script
vb script
 
Introduction to AWK utility on unix.pptx
Introduction to AWK utility on unix.pptxIntroduction to AWK utility on unix.pptx
Introduction to AWK utility on unix.pptx
 
Flink Forward Berlin 2018: Robert Bradshaw & Maximilian Michels - "Universal ...
Flink Forward Berlin 2018: Robert Bradshaw & Maximilian Michels - "Universal ...Flink Forward Berlin 2018: Robert Bradshaw & Maximilian Michels - "Universal ...
Flink Forward Berlin 2018: Robert Bradshaw & Maximilian Michels - "Universal ...
 
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry
Fundamentals of Stream Processing with Apache Beam, Tyler Akidau, Frances Perry
 
amala_storage
amala_storageamala_storage
amala_storage
 
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
 
The Archaeological Recording Kit: An open source solution to project recording
The Archaeological Recording Kit: An open source solution to project recordingThe Archaeological Recording Kit: An open source solution to project recording
The Archaeological Recording Kit: An open source solution to project recording
 
What's New in Spark 2?
What's New in Spark 2?What's New in Spark 2?
What's New in Spark 2?
 
FireWorks workflow software
FireWorks workflow softwareFireWorks workflow software
FireWorks workflow software
 
Awx
AwxAwx
Awx
 
Compiler Construction | Lecture 1 | What is a compiler?
Compiler Construction | Lecture 1 | What is a compiler?Compiler Construction | Lecture 1 | What is a compiler?
Compiler Construction | Lecture 1 | What is a compiler?
 
Java Course 1: Introduction
Java Course 1: IntroductionJava Course 1: Introduction
Java Course 1: Introduction
 
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10 an integration story
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10  an integration story[Spark Summit EU 2017] Apache spark streaming + kafka 0.10  an integration story
[Spark Summit EU 2017] Apache spark streaming + kafka 0.10 an integration story
 
Apache Spark Streaming + Kafka 0.10 with Joan Viladrosariera
Apache Spark Streaming + Kafka 0.10 with Joan ViladrosarieraApache Spark Streaming + Kafka 0.10 with Joan Viladrosariera
Apache Spark Streaming + Kafka 0.10 with Joan Viladrosariera
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
 
Amazon Elastic Beanstalk
Amazon Elastic BeanstalkAmazon Elastic Beanstalk
Amazon Elastic Beanstalk
 
Realizing the promise of portable data processing with Apache Beam
Realizing the promise of portable data processing with Apache BeamRealizing the promise of portable data processing with Apache Beam
Realizing the promise of portable data processing with Apache Beam
 

Recently uploaded

Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 

Recently uploaded (20)

Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 

Awk

  • 2. What are we going to talk? 01 What is AWK? 02 Why should we learn Scripting? 03 How AWK Scripts works? 04 How to write and execute scripts in AWK?
  • 3. What is AWK? -History and content-
  • 4. AWK Language Alfred Aho, Peter Weinberger, Brian Kernighan Authors Interpreted programming language/ Very powerful / specially designed for text processing Variants of AWK AWK - Original AWK from AT & T Laboratory. NAWK - Newer and improved version of AWK from AT & T Laboratory. GAWK - GNU AWK. All GNU/Linux distributions ship GAWK. fully compatible with AWK and NAWK.
  • 5. AWK Language More about AWK………….. ✓ Command/tool available in all the Linux/Unix flavors ✓ Perform activities ▪ processing text files(filtering, manipulation etc.) ▪ Reporting ✓ Consist of, Arithmetic operations Binary operations, conditions loops, functions Programming Language “Awk the Swiss army knife of the Unix toolkit”.
  • 6. Why should we learn Scripting? -script vs. program-
  • 7. Script vs. program Script - Scripting Language Program - Programming Language script is interpreted Program is executed set of rules to control another software application a. converts code line by line b. slower/less memory needed c. errors displayed for every line Set of instructions to perform a certain task a. converts whole code at a time b. Faster/more memory needed c. errors displayed after checking whole program https://www.youtube.com/watch?v=XgPrF3GOSMw
  • 8. What can we do with AWK? ❖ Manage small, personal databases ❖ Generate reports ❖ Validate data ❖ Produce indexes ❖ Perform document preparation tasks ❖ Experiment with algorithms (that can be adapted later to other computer languages)
  • 9. How AWK Scripts works? -Procedure-
  • 10. How AWK works? Works line by line -horizontal manner, reading one line after the other- Treats a file as group of columns -assign data to columns depending on the field separator- $1, $2, $3,………. : Assigned column numbers NF(Number of Fields): Last column number(built-in-variable) Different Conditions Columns Desired OutputApply on Get
  • 11. How to write and execute scripts in AWK? -Syntaxes and Examples-
  • 12. How to Write? o Awk scripts start with the line: #! /path/to/awk/utility –f E.g.If Awk utility is located in /usr/bin/awk then start line will be #! /usr/bin/awk -f #! /usr/bin/awk -f Interpreter Interpreter option (to read file) Specifies Interpreter Start
  • 13. How to Write? Rule in a script pattern { action } /aaronkilik/ { print "Username :",$1,"User ID :",$3,"User GID :",$4 } Save Script_Name.awk
  • 14. How to Execute? Change Privileges chmod +x Script_Name.awk Execute ./Script_Name.awk [input_files] E.g.: chmod +x first.awk E.g.: ./first.awk /etc/mydirect
  • 16. BEGIN { print "Users and their corresponding home" print " Username t HomePath" print "___________ t __________" FS=":" } { print $1 " t " $6 } END { print "The end" }
  • 18. record which is processed. count of processed records.