SlideShare a Scribd company logo
crontab and more
crontab and more
By : Khawar Nehal
26 October 2021
Agenda
awk
crontab
At
Shell scripting ( sh , bash )
Quizzes
Bloomy Week 3
Linux: Quiz 1
https://bloomy360.moodlecloud.com/mod/quiz/view.php?i
d=68
Linux: Quiz 2
https://bloomy360.moodlecloud.com/mod/quiz/view.php?i
d=69
Bloomy Week 5
Linux: Quiz
https://bloomy360.moodlecloud.com/mod/quiz/view.php?i
d=95
Awk
$cat > employee.txt
ajay manager account 45000
sunil clerk account 25000
varun manager sales 50000
amit manager account 47000
tarun peon sales 15000
deepak clerk sales 23000
sunil peon sales 13000
satvik director purchase 80000
Awk
$ awk '{print}' employee.txt
Output:
ajay manager account 45000
sunil clerk account 25000
varun manager sales 50000
amit manager account 47000
tarun peon sales 15000
deepak clerk sales 23000
sunil peon sales 13000
satvik director purchase 80000
Awk
Print the lines which match the given pattern.
$ awk '/manager/ {print}' employee.txt
Output:
ajay manager account 45000
varun manager sales 50000
amit manager account 47000
Awk
Splitting a Line Into Fields : For each record i.e line, the awk
command splits the record delimited by whitespace character by
default and stores it in the $n variables. If the line has 4 words, it
will be stored in $1, $2, $3 and $4 respectively. Also, $0 represents
the whole line.
Awk
$ awk '{print $1,$4}' employee.txt
Output:
ajay 45000
sunil 25000
varun 50000
amit 47000
tarun 15000
deepak 23000
sunil 13000
satvik 80000
Awk
In the above example, $1 and $4 represents Name and Salary
fields respectively.
Built-In Variables In Awk
Awk’s built-in variables include the field variables—$1, $2, $3, and
so on ($0 is the entire line) — that break a line of text into
individual words or pieces called fields.
Awk
NR: NR command keeps a current count of the number of input
records. Remember that records are usually lines. Awk command
performs the pattern/action statements once for each record in a
file.
NF: NF command keeps a count of the number of fields within
the current input record.
FS: FS command contains the field separator character which is
used to divide fields on the input line. The default is “white space”,
meaning space and tab characters. FS can be reassigned to
another character (typically in BEGIN) to change the field
separator.
Awk
RS: RS command stores the current record separator character.
Since, by default, an input line is the input record, the default
record separator character is a newline.
OFS: OFS command stores the output field separator, which
separates the fields when Awk prints them. The default is a blank
space. Whenever print has several parameters separated with
commas, it will print the value of OFS in between each parameter.
ORS: ORS command stores the output record separator, which
separates the output lines when Awk prints them. The default is a
newline character. print automatically outputs the contents of ORS
at the end of whatever it is given to print.
Awk
Examples:
Use of NR built-in variables (Display Line Number)
$ awk '{print NR,$0}' employee.txt
Output:
1 ajay manager account 45000
2 sunil clerk account 25000
3 varun manager sales 50000
4 amit manager account 47000
5 tarun peon sales 15000
6 deepak clerk sales 23000
7 sunil peon sales 13000
8 satvik director purchase 80000
Awk
In the above example, the awk command with NR prints all the lines along with
the line number.
Use of NF built-in variables (Display Last Field)
Awk
$ awk '{print $1,$NF}' employee.txt
Output:
ajay 45000
sunil 25000
varun 50000
amit 47000
tarun 15000
deepak 23000
sunil 13000
satvik 80000
In the above example $1 represents Name and $NF represents Salary. We can
get the Salary using $NF , where $NF represents last field.
Awk
Another use of NR built-in variables (Display Line From 3 to 6)
$ awk 'NR==3, NR==6 {print NR,$0}' employee.txt
Output:
3 varun manager sales 50000
4 amit manager account 47000
5 tarun peon sales 15000
6 deepak clerk sales 23000
Awk
$cat > geeksforgeeks.txt
A B C
Tarun A12 1
Man B6 2
Praveen M42 3
Awk
1) To print the first item along with the row number(NR) separated with ” – “ from
each line in geeksforgeeks.txt:
$ awk '{print NR "- " $1 }' geeksforgeeks.txt
1 - A
2 - Tarun
3 – Manav
4 - Praveen
Awk
To return the second row/item from geeksforgeeks.txt:
The question should be:- To return the second column/item from
geeksforgeeks.txt:
$ awk '{print $2}' geeksforgeeks.txt
A12
B6
M42
Awk
More on awk
https://www.geeksforgeeks.org/awk-command-unixlinux-examples/
Cron
Cron
Cron
Cron
Cron
Cron
Cron
Cron
Cron
Cron
Cron
Cron
Cron
Cron
Cron
More on crontab
https://www.adminschoice.com/crontab-quick-refe
rence
crontab
Crontab calculator
https://crontab.guru/

More Related Content

What's hot

Workshop on command line tools - day 1
Workshop on command line tools - day 1Workshop on command line tools - day 1
Workshop on command line tools - day 1
Leandro Lima
 
ES6 Simplified
ES6 SimplifiedES6 Simplified
ES6 Simplified
Carlos Ble
 
Dataflow: Declarative concurrency in Ruby
Dataflow: Declarative concurrency in RubyDataflow: Declarative concurrency in Ruby
Dataflow: Declarative concurrency in Ruby
Larry Diehl
 
Dig1108 Lesson 3
Dig1108 Lesson 3Dig1108 Lesson 3
Dig1108 Lesson 3
vc-dig1108-fall-2013
 
The Art of Command Line (2021)
The Art of Command Line (2021)The Art of Command Line (2021)
The Art of Command Line (2021)
Kenta Yamamoto
 
Intro to C++
Intro to C++Intro to C++
Intro to C++
Ahmed Farag
 
Sol7
Sol7Sol7
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
ramyaranjith
 
Exercice.docx
Exercice.docxExercice.docx
Exercice.docx
imane26
 
JavaScript Event Loop
JavaScript Event LoopJavaScript Event Loop
JavaScript Event Loop
Designveloper
 
Advanced Patterns with io.ReadWriter
Advanced Patterns with io.ReadWriterAdvanced Patterns with io.ReadWriter
Advanced Patterns with io.ReadWriter
Weaveworks
 
Variadic functions
Variadic functionsVariadic functions
Variadic functions
ramyaranjith
 
Hive practice
Hive practiceHive practice
Hive practice
AnkalaRao Chinthapalli
 
01c shell
01c shell01c shell
01c shell
Kevin Lee
 
Performance testing of microservices in Action
Performance testing of microservices in ActionPerformance testing of microservices in Action
Performance testing of microservices in Action
Alexander Kachur
 
Exploiting Memory Overflows
Exploiting Memory OverflowsExploiting Memory Overflows
Exploiting Memory Overflows
Ankur Tyagi
 
Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6
Nilesh Jayanandana
 
TLPI - 6 Process
TLPI - 6 ProcessTLPI - 6 Process
TLPI - 6 Process
Shu-Yu Fu
 
ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overview
hesher
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
akaptur
 

What's hot (20)

Workshop on command line tools - day 1
Workshop on command line tools - day 1Workshop on command line tools - day 1
Workshop on command line tools - day 1
 
ES6 Simplified
ES6 SimplifiedES6 Simplified
ES6 Simplified
 
Dataflow: Declarative concurrency in Ruby
Dataflow: Declarative concurrency in RubyDataflow: Declarative concurrency in Ruby
Dataflow: Declarative concurrency in Ruby
 
Dig1108 Lesson 3
Dig1108 Lesson 3Dig1108 Lesson 3
Dig1108 Lesson 3
 
The Art of Command Line (2021)
The Art of Command Line (2021)The Art of Command Line (2021)
The Art of Command Line (2021)
 
Intro to C++
Intro to C++Intro to C++
Intro to C++
 
Sol7
Sol7Sol7
Sol7
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
Exercice.docx
Exercice.docxExercice.docx
Exercice.docx
 
JavaScript Event Loop
JavaScript Event LoopJavaScript Event Loop
JavaScript Event Loop
 
Advanced Patterns with io.ReadWriter
Advanced Patterns with io.ReadWriterAdvanced Patterns with io.ReadWriter
Advanced Patterns with io.ReadWriter
 
Variadic functions
Variadic functionsVariadic functions
Variadic functions
 
Hive practice
Hive practiceHive practice
Hive practice
 
01c shell
01c shell01c shell
01c shell
 
Performance testing of microservices in Action
Performance testing of microservices in ActionPerformance testing of microservices in Action
Performance testing of microservices in Action
 
Exploiting Memory Overflows
Exploiting Memory OverflowsExploiting Memory Overflows
Exploiting Memory Overflows
 
Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6Introduction to Ecmascript - ES6
Introduction to Ecmascript - ES6
 
TLPI - 6 Process
TLPI - 6 ProcessTLPI - 6 Process
TLPI - 6 Process
 
ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overview
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
 

Similar to Linux class 15 26 oct 2021

Awk programming
Awk programming Awk programming
Awk programming
Dr.M.Karthika parthasarathy
 
Unix - Class7 - awk
Unix - Class7 - awkUnix - Class7 - awk
Unix - Class7 - awk
Nihar Ranjan Paital
 
awk_intro.ppt
awk_intro.pptawk_intro.ppt
awk_intro.ppt
PrasadReddy710753
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
Mufaddal Haidermota
 
Awk A Pattern Scanning And Processing Language
Awk   A Pattern Scanning And Processing LanguageAwk   A Pattern Scanning And Processing Language
Awk A Pattern Scanning And Processing Language
Crystal Sanchez
 
Unix day4 v1.3
Unix day4 v1.3Unix day4 v1.3
Unix day4 v1.3
xavier john
 
Advanced perl finer points ,pack&unpack,eval,files
Advanced perl   finer points ,pack&unpack,eval,filesAdvanced perl   finer points ,pack&unpack,eval,files
Advanced perl finer points ,pack&unpack,eval,files
Shankar D
 
Lab07 (1)
Lab07 (1)Lab07 (1)
Lab07 (1)
AlexisHarvey8
 
Awk Introduction
Awk IntroductionAwk Introduction
Awk Introduction
Anthony Magee
 
NS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIINS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt III
Ajit Nayak
 
lab-assgn-practical-file-xii-cs.pdf
lab-assgn-practical-file-xii-cs.pdflab-assgn-practical-file-xii-cs.pdf
lab-assgn-practical-file-xii-cs.pdf
JeevithaG22
 
Awk-An Advanced Filter
Awk-An Advanced FilterAwk-An Advanced Filter
Awk-An Advanced Filter
Tye Rausch
 
VI Editor
VI EditorVI Editor
VI Editor
Nishant Munjal
 
Awk essentials
Awk essentialsAwk essentials
Awk essentials
Logan Palanisamy
 
of 70UNIX Unbounded 5th EditionAmir Afzal .docx
 of 70UNIX Unbounded 5th EditionAmir Afzal .docx of 70UNIX Unbounded 5th EditionAmir Afzal .docx
of 70UNIX Unbounded 5th EditionAmir Afzal .docx
MARRY7
 
of 70UNIX Unbounded 5th EditionAmir Afzal .docx
of 70UNIX Unbounded 5th EditionAmir Afzal .docxof 70UNIX Unbounded 5th EditionAmir Afzal .docx
of 70UNIX Unbounded 5th EditionAmir Afzal .docx
adkinspaige22
 
RHCSA EX200 - Summary
RHCSA EX200 - SummaryRHCSA EX200 - Summary
RHCSA EX200 - Summary
Nugroho Gito
 
Macros for Shape and formula
Macros for Shape and formulaMacros for Shape and formula
Macros for Shape and formula
Pramodkumar Jha
 
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaaShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
ewout2
 
Awk --- A Pattern Scanning And Processing Language (Second Edition)
Awk --- A Pattern Scanning And Processing Language (Second Edition)Awk --- A Pattern Scanning And Processing Language (Second Edition)
Awk --- A Pattern Scanning And Processing Language (Second Edition)
Brooke Heidt
 

Similar to Linux class 15 26 oct 2021 (20)

Awk programming
Awk programming Awk programming
Awk programming
 
Unix - Class7 - awk
Unix - Class7 - awkUnix - Class7 - awk
Unix - Class7 - awk
 
awk_intro.ppt
awk_intro.pptawk_intro.ppt
awk_intro.ppt
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Awk A Pattern Scanning And Processing Language
Awk   A Pattern Scanning And Processing LanguageAwk   A Pattern Scanning And Processing Language
Awk A Pattern Scanning And Processing Language
 
Unix day4 v1.3
Unix day4 v1.3Unix day4 v1.3
Unix day4 v1.3
 
Advanced perl finer points ,pack&unpack,eval,files
Advanced perl   finer points ,pack&unpack,eval,filesAdvanced perl   finer points ,pack&unpack,eval,files
Advanced perl finer points ,pack&unpack,eval,files
 
Lab07 (1)
Lab07 (1)Lab07 (1)
Lab07 (1)
 
Awk Introduction
Awk IntroductionAwk Introduction
Awk Introduction
 
NS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIINS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt III
 
lab-assgn-practical-file-xii-cs.pdf
lab-assgn-practical-file-xii-cs.pdflab-assgn-practical-file-xii-cs.pdf
lab-assgn-practical-file-xii-cs.pdf
 
Awk-An Advanced Filter
Awk-An Advanced FilterAwk-An Advanced Filter
Awk-An Advanced Filter
 
VI Editor
VI EditorVI Editor
VI Editor
 
Awk essentials
Awk essentialsAwk essentials
Awk essentials
 
of 70UNIX Unbounded 5th EditionAmir Afzal .docx
 of 70UNIX Unbounded 5th EditionAmir Afzal .docx of 70UNIX Unbounded 5th EditionAmir Afzal .docx
of 70UNIX Unbounded 5th EditionAmir Afzal .docx
 
of 70UNIX Unbounded 5th EditionAmir Afzal .docx
of 70UNIX Unbounded 5th EditionAmir Afzal .docxof 70UNIX Unbounded 5th EditionAmir Afzal .docx
of 70UNIX Unbounded 5th EditionAmir Afzal .docx
 
RHCSA EX200 - Summary
RHCSA EX200 - SummaryRHCSA EX200 - Summary
RHCSA EX200 - Summary
 
Macros for Shape and formula
Macros for Shape and formulaMacros for Shape and formula
Macros for Shape and formula
 
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaaShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
ShellAdvanced aaäaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Awk --- A Pattern Scanning And Processing Language (Second Edition)
Awk --- A Pattern Scanning And Processing Language (Second Edition)Awk --- A Pattern Scanning And Processing Language (Second Edition)
Awk --- A Pattern Scanning And Processing Language (Second Edition)
 

More from Khawar Nehal khawar.nehal@atrc.net.pk

Linux Class 1 Reasons to use linux
Linux Class 1 Reasons to use linux Linux Class 1 Reasons to use linux
Linux Class 1 Reasons to use linux
Khawar Nehal khawar.nehal@atrc.net.pk
 
Same old lessons in investing
Same old lessons in investingSame old lessons in investing
Same old lessons in investing
Khawar Nehal khawar.nehal@atrc.net.pk
 
Linux class 10 15 oct 2021-6
Linux class 10   15 oct 2021-6Linux class 10   15 oct 2021-6
Linux class 10 15 oct 2021-6
Khawar Nehal khawar.nehal@atrc.net.pk
 
Linux class 9 15 oct 2021-5
Linux class 9   15 oct 2021-5Linux class 9   15 oct 2021-5
Linux class 9 15 oct 2021-5
Khawar Nehal khawar.nehal@atrc.net.pk
 
Linux class 8 tar
Linux class 8   tar  Linux class 8   tar
File systems linux class 8
File systems linux class 8File systems linux class 8
File systems linux class 8
Khawar Nehal khawar.nehal@atrc.net.pk
 
Linux commands Class 5 - 8 oct 2021
Linux commands Class 5 - 8 oct 2021Linux commands Class 5 - 8 oct 2021
Linux commands Class 5 - 8 oct 2021
Khawar Nehal khawar.nehal@atrc.net.pk
 
Linux course fhs file hierarchy standard
Linux   course   fhs file hierarchy standardLinux   course   fhs file hierarchy standard
Linux course fhs file hierarchy standard
Khawar Nehal khawar.nehal@atrc.net.pk
 
Linux passwords class 4
Linux passwords class 4Linux passwords class 4
Linux passwords class 4
Khawar Nehal khawar.nehal@atrc.net.pk
 
Using linux 5 oct 2021 3
Using linux 5 oct 2021 3Using linux 5 oct 2021 3
Using linux 5 oct 2021 3
Khawar Nehal khawar.nehal@atrc.net.pk
 
Everyday uses of linux
Everyday uses of linux  Everyday uses of linux
Everyday uses of linux
Khawar Nehal khawar.nehal@atrc.net.pk
 
Computing people
Computing people  Computing people
Artificial Intelligence by Khawar Nehal
Artificial Intelligence by Khawar NehalArtificial Intelligence by Khawar Nehal
Artificial Intelligence by Khawar Nehal
Khawar Nehal khawar.nehal@atrc.net.pk
 
Artificial Intelligence in Banking
Artificial Intelligence in BankingArtificial Intelligence in Banking
Artificial Intelligence in Banking
Khawar Nehal khawar.nehal@atrc.net.pk
 
Electric Vehicles
Electric VehiclesElectric Vehicles
Electric Vehicles
Electric VehiclesElectric Vehicles
RevOps Revenue Operations
RevOps Revenue OperationsRevOps Revenue Operations
RevOps Revenue Operations
Khawar Nehal khawar.nehal@atrc.net.pk
 
Management techniques of the world by khawar nehal 4 august 2020-1
Management techniques of the world by khawar nehal   4 august 2020-1Management techniques of the world by khawar nehal   4 august 2020-1
Management techniques of the world by khawar nehal 4 august 2020-1
Khawar Nehal khawar.nehal@atrc.net.pk
 
Kona (TM) Autonomous Cars Anti Collision System
Kona (TM) Autonomous Cars Anti Collision SystemKona (TM) Autonomous Cars Anti Collision System
Kona (TM) Autonomous Cars Anti Collision System
Khawar Nehal khawar.nehal@atrc.net.pk
 
What was learned about what works in distance learning in 2020
What was learned about what works in distance learning in 2020What was learned about what works in distance learning in 2020
What was learned about what works in distance learning in 2020
Khawar Nehal khawar.nehal@atrc.net.pk
 

More from Khawar Nehal khawar.nehal@atrc.net.pk (20)

Linux Class 1 Reasons to use linux
Linux Class 1 Reasons to use linux Linux Class 1 Reasons to use linux
Linux Class 1 Reasons to use linux
 
Same old lessons in investing
Same old lessons in investingSame old lessons in investing
Same old lessons in investing
 
Linux class 10 15 oct 2021-6
Linux class 10   15 oct 2021-6Linux class 10   15 oct 2021-6
Linux class 10 15 oct 2021-6
 
Linux class 9 15 oct 2021-5
Linux class 9   15 oct 2021-5Linux class 9   15 oct 2021-5
Linux class 9 15 oct 2021-5
 
Linux class 8 tar
Linux class 8   tar  Linux class 8   tar
Linux class 8 tar
 
File systems linux class 8
File systems linux class 8File systems linux class 8
File systems linux class 8
 
Linux commands Class 5 - 8 oct 2021
Linux commands Class 5 - 8 oct 2021Linux commands Class 5 - 8 oct 2021
Linux commands Class 5 - 8 oct 2021
 
Linux course fhs file hierarchy standard
Linux   course   fhs file hierarchy standardLinux   course   fhs file hierarchy standard
Linux course fhs file hierarchy standard
 
Linux passwords class 4
Linux passwords class 4Linux passwords class 4
Linux passwords class 4
 
Using linux 5 oct 2021 3
Using linux 5 oct 2021 3Using linux 5 oct 2021 3
Using linux 5 oct 2021 3
 
Everyday uses of linux
Everyday uses of linux  Everyday uses of linux
Everyday uses of linux
 
Computing people
Computing people  Computing people
Computing people
 
Artificial Intelligence by Khawar Nehal
Artificial Intelligence by Khawar NehalArtificial Intelligence by Khawar Nehal
Artificial Intelligence by Khawar Nehal
 
Artificial Intelligence in Banking
Artificial Intelligence in BankingArtificial Intelligence in Banking
Artificial Intelligence in Banking
 
Electric Vehicles
Electric VehiclesElectric Vehicles
Electric Vehicles
 
Electric Vehicles
Electric VehiclesElectric Vehicles
Electric Vehicles
 
RevOps Revenue Operations
RevOps Revenue OperationsRevOps Revenue Operations
RevOps Revenue Operations
 
Management techniques of the world by khawar nehal 4 august 2020-1
Management techniques of the world by khawar nehal   4 august 2020-1Management techniques of the world by khawar nehal   4 august 2020-1
Management techniques of the world by khawar nehal 4 august 2020-1
 
Kona (TM) Autonomous Cars Anti Collision System
Kona (TM) Autonomous Cars Anti Collision SystemKona (TM) Autonomous Cars Anti Collision System
Kona (TM) Autonomous Cars Anti Collision System
 
What was learned about what works in distance learning in 2020
What was learned about what works in distance learning in 2020What was learned about what works in distance learning in 2020
What was learned about what works in distance learning in 2020
 

Recently uploaded

SD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
SD_Integrating 21st Century Skills in Classroom-based Assessment.pptxSD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
SD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
elwoodprias1
 
Demonstration module in Odoo 17 - Odoo 17 Slides
Demonstration module in Odoo 17 - Odoo 17 SlidesDemonstration module in Odoo 17 - Odoo 17 Slides
Demonstration module in Odoo 17 - Odoo 17 Slides
Celine George
 
DepEd School Calendar 2024-2025 DO_s2024_008
DepEd School Calendar 2024-2025 DO_s2024_008DepEd School Calendar 2024-2025 DO_s2024_008
DepEd School Calendar 2024-2025 DO_s2024_008
Glenn Rivera
 
QCE – Unpacking the syllabus Implications for Senior School practices and ass...
QCE – Unpacking the syllabus Implications for Senior School practices and ass...QCE – Unpacking the syllabus Implications for Senior School practices and ass...
QCE – Unpacking the syllabus Implications for Senior School practices and ass...
mansk2
 
2 Post harvest Physiology of Horticulture produce.pptx
2 Post harvest Physiology of Horticulture  produce.pptx2 Post harvest Physiology of Horticulture  produce.pptx
2 Post harvest Physiology of Horticulture produce.pptx
UmeshTimilsina1
 
Open Source and AI - ByWater Closing Keynote Presentation.pdf
Open Source and AI - ByWater Closing Keynote Presentation.pdfOpen Source and AI - ByWater Closing Keynote Presentation.pdf
Open Source and AI - ByWater Closing Keynote Presentation.pdf
Jessica Zairo
 
INSIDE OUT - PowerPoint Presentation.pptx
INSIDE OUT - PowerPoint Presentation.pptxINSIDE OUT - PowerPoint Presentation.pptx
INSIDE OUT - PowerPoint Presentation.pptx
RODELAZARES3
 
SQL Server Interview Questions PDF By ScholarHat
SQL Server Interview Questions PDF By ScholarHatSQL Server Interview Questions PDF By ScholarHat
SQL Server Interview Questions PDF By ScholarHat
Scholarhat
 
RDBMS Lecture Notes Unit4 chapter12 VIEW
RDBMS Lecture Notes Unit4 chapter12 VIEWRDBMS Lecture Notes Unit4 chapter12 VIEW
RDBMS Lecture Notes Unit4 chapter12 VIEW
Murugan Solaiyappan
 
C# Interview Questions PDF By ScholarHat.pdf
C# Interview Questions PDF By ScholarHat.pdfC# Interview Questions PDF By ScholarHat.pdf
C# Interview Questions PDF By ScholarHat.pdf
Scholarhat
 
Brigada Eskwela 2024 PowerPoint Update for SY 2024-2025
Brigada Eskwela 2024 PowerPoint Update for SY 2024-2025Brigada Eskwela 2024 PowerPoint Update for SY 2024-2025
Brigada Eskwela 2024 PowerPoint Update for SY 2024-2025
ALBERTHISOLER1
 
Lecture Notes Unit4 Chapter13 users , roles and privileges
Lecture Notes Unit4 Chapter13 users , roles and privilegesLecture Notes Unit4 Chapter13 users , roles and privileges
Lecture Notes Unit4 Chapter13 users , roles and privileges
Murugan146644
 
2024 Winter SWAYAM NPTEL & A Student.pptx
2024 Winter SWAYAM NPTEL & A Student.pptx2024 Winter SWAYAM NPTEL & A Student.pptx
2024 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
7. Post Harvest Entomology and their control.pptx
7. Post Harvest Entomology and their control.pptx7. Post Harvest Entomology and their control.pptx
7. Post Harvest Entomology and their control.pptx
UmeshTimilsina1
 
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
Codeavour International
 
Dr. Nasir Mustafa CERTIFICATE OF APPRECIATION "NEUROANATOMY"
Dr. Nasir Mustafa CERTIFICATE OF APPRECIATION "NEUROANATOMY"Dr. Nasir Mustafa CERTIFICATE OF APPRECIATION "NEUROANATOMY"
Dr. Nasir Mustafa CERTIFICATE OF APPRECIATION "NEUROANATOMY"
Dr. Nasir Mustafa
 
MVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHatMVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHat
Scholarhat
 
Mail Server Configuration Using App passwords in Odoo 17
Mail Server Configuration Using App passwords in Odoo 17Mail Server Configuration Using App passwords in Odoo 17
Mail Server Configuration Using App passwords in Odoo 17
Celine George
 
Introduction to Google Productivity Tools for Office and Personal Use
Introduction to Google Productivity Tools for Office and Personal UseIntroduction to Google Productivity Tools for Office and Personal Use
Introduction to Google Productivity Tools for Office and Personal Use
Excellence Foundation for South Sudan
 
3. Maturity_indices_of_fruits_and_vegetable.pptx
3. Maturity_indices_of_fruits_and_vegetable.pptx3. Maturity_indices_of_fruits_and_vegetable.pptx
3. Maturity_indices_of_fruits_and_vegetable.pptx
UmeshTimilsina1
 

Recently uploaded (20)

SD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
SD_Integrating 21st Century Skills in Classroom-based Assessment.pptxSD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
SD_Integrating 21st Century Skills in Classroom-based Assessment.pptx
 
Demonstration module in Odoo 17 - Odoo 17 Slides
Demonstration module in Odoo 17 - Odoo 17 SlidesDemonstration module in Odoo 17 - Odoo 17 Slides
Demonstration module in Odoo 17 - Odoo 17 Slides
 
DepEd School Calendar 2024-2025 DO_s2024_008
DepEd School Calendar 2024-2025 DO_s2024_008DepEd School Calendar 2024-2025 DO_s2024_008
DepEd School Calendar 2024-2025 DO_s2024_008
 
QCE – Unpacking the syllabus Implications for Senior School practices and ass...
QCE – Unpacking the syllabus Implications for Senior School practices and ass...QCE – Unpacking the syllabus Implications for Senior School practices and ass...
QCE – Unpacking the syllabus Implications for Senior School practices and ass...
 
2 Post harvest Physiology of Horticulture produce.pptx
2 Post harvest Physiology of Horticulture  produce.pptx2 Post harvest Physiology of Horticulture  produce.pptx
2 Post harvest Physiology of Horticulture produce.pptx
 
Open Source and AI - ByWater Closing Keynote Presentation.pdf
Open Source and AI - ByWater Closing Keynote Presentation.pdfOpen Source and AI - ByWater Closing Keynote Presentation.pdf
Open Source and AI - ByWater Closing Keynote Presentation.pdf
 
INSIDE OUT - PowerPoint Presentation.pptx
INSIDE OUT - PowerPoint Presentation.pptxINSIDE OUT - PowerPoint Presentation.pptx
INSIDE OUT - PowerPoint Presentation.pptx
 
SQL Server Interview Questions PDF By ScholarHat
SQL Server Interview Questions PDF By ScholarHatSQL Server Interview Questions PDF By ScholarHat
SQL Server Interview Questions PDF By ScholarHat
 
RDBMS Lecture Notes Unit4 chapter12 VIEW
RDBMS Lecture Notes Unit4 chapter12 VIEWRDBMS Lecture Notes Unit4 chapter12 VIEW
RDBMS Lecture Notes Unit4 chapter12 VIEW
 
C# Interview Questions PDF By ScholarHat.pdf
C# Interview Questions PDF By ScholarHat.pdfC# Interview Questions PDF By ScholarHat.pdf
C# Interview Questions PDF By ScholarHat.pdf
 
Brigada Eskwela 2024 PowerPoint Update for SY 2024-2025
Brigada Eskwela 2024 PowerPoint Update for SY 2024-2025Brigada Eskwela 2024 PowerPoint Update for SY 2024-2025
Brigada Eskwela 2024 PowerPoint Update for SY 2024-2025
 
Lecture Notes Unit4 Chapter13 users , roles and privileges
Lecture Notes Unit4 Chapter13 users , roles and privilegesLecture Notes Unit4 Chapter13 users , roles and privileges
Lecture Notes Unit4 Chapter13 users , roles and privileges
 
2024 Winter SWAYAM NPTEL & A Student.pptx
2024 Winter SWAYAM NPTEL & A Student.pptx2024 Winter SWAYAM NPTEL & A Student.pptx
2024 Winter SWAYAM NPTEL & A Student.pptx
 
7. Post Harvest Entomology and their control.pptx
7. Post Harvest Entomology and their control.pptx7. Post Harvest Entomology and their control.pptx
7. Post Harvest Entomology and their control.pptx
 
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
Codeavour 5.0 International Impact Report - The Biggest International AI, Cod...
 
Dr. Nasir Mustafa CERTIFICATE OF APPRECIATION "NEUROANATOMY"
Dr. Nasir Mustafa CERTIFICATE OF APPRECIATION "NEUROANATOMY"Dr. Nasir Mustafa CERTIFICATE OF APPRECIATION "NEUROANATOMY"
Dr. Nasir Mustafa CERTIFICATE OF APPRECIATION "NEUROANATOMY"
 
MVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHatMVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHat
 
Mail Server Configuration Using App passwords in Odoo 17
Mail Server Configuration Using App passwords in Odoo 17Mail Server Configuration Using App passwords in Odoo 17
Mail Server Configuration Using App passwords in Odoo 17
 
Introduction to Google Productivity Tools for Office and Personal Use
Introduction to Google Productivity Tools for Office and Personal UseIntroduction to Google Productivity Tools for Office and Personal Use
Introduction to Google Productivity Tools for Office and Personal Use
 
3. Maturity_indices_of_fruits_and_vegetable.pptx
3. Maturity_indices_of_fruits_and_vegetable.pptx3. Maturity_indices_of_fruits_and_vegetable.pptx
3. Maturity_indices_of_fruits_and_vegetable.pptx
 

Linux class 15 26 oct 2021

  • 2. crontab and more By : Khawar Nehal 26 October 2021
  • 4. Quizzes Bloomy Week 3 Linux: Quiz 1 https://bloomy360.moodlecloud.com/mod/quiz/view.php?i d=68 Linux: Quiz 2 https://bloomy360.moodlecloud.com/mod/quiz/view.php?i d=69 Bloomy Week 5 Linux: Quiz https://bloomy360.moodlecloud.com/mod/quiz/view.php?i d=95
  • 5. Awk $cat > employee.txt ajay manager account 45000 sunil clerk account 25000 varun manager sales 50000 amit manager account 47000 tarun peon sales 15000 deepak clerk sales 23000 sunil peon sales 13000 satvik director purchase 80000
  • 6. Awk $ awk '{print}' employee.txt Output: ajay manager account 45000 sunil clerk account 25000 varun manager sales 50000 amit manager account 47000 tarun peon sales 15000 deepak clerk sales 23000 sunil peon sales 13000 satvik director purchase 80000
  • 7. Awk Print the lines which match the given pattern. $ awk '/manager/ {print}' employee.txt Output: ajay manager account 45000 varun manager sales 50000 amit manager account 47000
  • 8. Awk Splitting a Line Into Fields : For each record i.e line, the awk command splits the record delimited by whitespace character by default and stores it in the $n variables. If the line has 4 words, it will be stored in $1, $2, $3 and $4 respectively. Also, $0 represents the whole line.
  • 9. Awk $ awk '{print $1,$4}' employee.txt Output: ajay 45000 sunil 25000 varun 50000 amit 47000 tarun 15000 deepak 23000 sunil 13000 satvik 80000
  • 10. Awk In the above example, $1 and $4 represents Name and Salary fields respectively. Built-In Variables In Awk Awk’s built-in variables include the field variables—$1, $2, $3, and so on ($0 is the entire line) — that break a line of text into individual words or pieces called fields.
  • 11. Awk NR: NR command keeps a current count of the number of input records. Remember that records are usually lines. Awk command performs the pattern/action statements once for each record in a file. NF: NF command keeps a count of the number of fields within the current input record. FS: FS command contains the field separator character which is used to divide fields on the input line. The default is “white space”, meaning space and tab characters. FS can be reassigned to another character (typically in BEGIN) to change the field separator.
  • 12. Awk RS: RS command stores the current record separator character. Since, by default, an input line is the input record, the default record separator character is a newline. OFS: OFS command stores the output field separator, which separates the fields when Awk prints them. The default is a blank space. Whenever print has several parameters separated with commas, it will print the value of OFS in between each parameter. ORS: ORS command stores the output record separator, which separates the output lines when Awk prints them. The default is a newline character. print automatically outputs the contents of ORS at the end of whatever it is given to print.
  • 13. Awk Examples: Use of NR built-in variables (Display Line Number) $ awk '{print NR,$0}' employee.txt Output: 1 ajay manager account 45000 2 sunil clerk account 25000 3 varun manager sales 50000 4 amit manager account 47000 5 tarun peon sales 15000 6 deepak clerk sales 23000 7 sunil peon sales 13000 8 satvik director purchase 80000
  • 14. Awk In the above example, the awk command with NR prints all the lines along with the line number. Use of NF built-in variables (Display Last Field)
  • 15. Awk $ awk '{print $1,$NF}' employee.txt Output: ajay 45000 sunil 25000 varun 50000 amit 47000 tarun 15000 deepak 23000 sunil 13000 satvik 80000 In the above example $1 represents Name and $NF represents Salary. We can get the Salary using $NF , where $NF represents last field.
  • 16. Awk Another use of NR built-in variables (Display Line From 3 to 6) $ awk 'NR==3, NR==6 {print NR,$0}' employee.txt Output: 3 varun manager sales 50000 4 amit manager account 47000 5 tarun peon sales 15000 6 deepak clerk sales 23000
  • 17. Awk $cat > geeksforgeeks.txt A B C Tarun A12 1 Man B6 2 Praveen M42 3
  • 18. Awk 1) To print the first item along with the row number(NR) separated with ” – “ from each line in geeksforgeeks.txt: $ awk '{print NR "- " $1 }' geeksforgeeks.txt 1 - A 2 - Tarun 3 – Manav 4 - Praveen
  • 19. Awk To return the second row/item from geeksforgeeks.txt: The question should be:- To return the second column/item from geeksforgeeks.txt: $ awk '{print $2}' geeksforgeeks.txt A12 B6 M42
  • 21. Cron
  • 22. Cron
  • 23. Cron
  • 24. Cron
  • 25. Cron
  • 26. Cron
  • 27. Cron
  • 28. Cron
  • 29. Cron
  • 30. Cron
  • 31. Cron
  • 32. Cron
  • 33. Cron
  • 34. Cron