SlideShare a Scribd company logo
Text Processing Tools
grep
• ‘grep’ is used to search for strings and/or regular-expressions
(REGEX) in other commands’ outputs or as a search tool on its
own.
• In order to search for a string within file, we can use:
 # grep -i ’user1' /etc/passwd
user1:x:500:500::/home/user1:/bin/bash
• ‘grep’ will output the entire line in which the string we
searched for was found, as seen in the example above.
grep
• grep has many options we can use; some of the common
ones are:
 -i : case-insensitive; do not mind upper or lower case.
 -v : return anything that is NOT the string we’ve searched for.
 -r / -R : recursive; search through sub-directories as well.
 -q : suppress all normal output; useful when checking and evaluating
in scripts.
• For the full list of options, run: “grep --help” or “man grep”.
grep
• There are two more variants of grep:
 fgrep – suited for string searches only; the searches are performed
faster.
 egrep – suited for extended regex searches.
• grep can also be used as a filter, on the right side of pipes in
order to display only specific outputs:
# ls -l | grep “kf”
-rw-rw-r-- 1 nir test 0 Jul 19 15:11 kfile9
cut
• The “cut” command is used to filter out either fields or
columns of text.
• Syntax:
 cut [options] [filename(s)]
• Options:
 -f’[n]’ : [n] refers to field number(s); the fields must be separated by
a delimiter.
 -d’[delimiter]’ : this option defines which character in our string is
the delimiter; if this option is not supplied by the user, the default
will be used (TAB).
# cut -f'6','7' -d':' /etc/passwd | grep user1
/home/user1:/bin/bash
sort
• The “sort” command enabled sorting of data in numerical or
alphabetical orders.
• Syntax:
 sort [options] [filename(s)]
• Options:
 -m – merge already sorted files
 -r - reverse sort order
 -M – month name sort
 -n – numeric sort
 -u – unique sort; display only the first match of a repetitive string in
the file, only once.
uniq
• The “uniq” command searches for duplicates line of data.
• Syntax:
 uniq [options] [filename(s)]
• Options:
 -u – show only lines that are not repeated
 -d – show only one copy of the duplicate line
 -c – output each line with the count of occurrences
 -I – case-insensitive
tr
• The “tr” command is used to translate characters.
It uses two sets of characters, given as command arguments and converts
them on a char-to-char basis. Is can also:
 Converts letter cases; upper to lower and vice-versa.
 Recognizes special characters, such as n (newline)
 Cannot open files; can only use data from pipes or redirections from
within files.
• Syntax:
 tr [options] charter-list1 charter-list2 < [file]
• Options:
 -d – delete all characters appearing in “chars1”
 -s - replace instances of repeated characters with a single character.
 -cd – delete all characters that are NOT in “chars1”
tail
• The “tail” command prints the end of a file
• Syntax:
 tail [options] [filename(s)]
• Options:
 -n+N print the last N lines (default is 10)
 -n-N print the entire file starting from line N
 -f follow mode. tail will stay active and update on each new line to the
file
head
• The “head” command prints the start of a file
• Syntax:
 head [options] [filename(s)]
• Options:
 -n+N print the first N lines (default is 10)
 -n-N print the entire file until the Nth line

More Related Content

What's hot

Learning sed and awk
Learning sed and awkLearning sed and awk
Learning sed and awk
Yogesh Sawant
 
Grep - A powerful search utility
Grep - A powerful search utilityGrep - A powerful search utility
Grep - A powerful search utility
Nirajan Pant
 
Unit5 C
Unit5 C Unit5 C
Unit5 C
arnold 7490
 
Unix command line concepts
Unix command line conceptsUnix command line concepts
Unix command line concepts
Artem Nagornyi
 
15 practical grep command examples in linux
15 practical grep command examples in linux15 practical grep command examples in linux
15 practical grep command examples in linux
Teja Bheemanapally
 
Grep
GrepGrep
Spsl II unit
Spsl   II unitSpsl   II unit
Spsl II unit
Sasidhar Kothuru
 
Unix / Linux Command Reference
Unix / Linux Command ReferenceUnix / Linux Command Reference
Unix / Linux Command Reference
Sumankumar Panchal
 
Pipes and filters
Pipes and filtersPipes and filters
Pipes and filters
vijethabhat85
 
Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014
Noé Fernández-Pozo
 
2
22
Regular Expressions grep and egrep
Regular Expressions grep and egrepRegular Expressions grep and egrep
Regular Expressions grep and egrep
Tri Truong
 
Unix Basics Commands
Unix Basics CommandsUnix Basics Commands
Unix Basics Commands
Sameeran Jenna
 
File management in C++
File management in C++File management in C++
File management in C++
apoorvaverma33
 
Learning Grep
Learning GrepLearning Grep
Learning Grep
Vikas Kumar CSM®
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystem
root_fibo
 
Linux
LinuxLinux
file management in c language
file management in c languagefile management in c language
file management in c language
chintan makwana
 
Programming in C Session 4
Programming in C Session 4Programming in C Session 4
Programming in C Session 4
Prerna Sharma
 
Linux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for BeginnersLinux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for Beginners
Davide Ciambelli
 

What's hot (20)

Learning sed and awk
Learning sed and awkLearning sed and awk
Learning sed and awk
 
Grep - A powerful search utility
Grep - A powerful search utilityGrep - A powerful search utility
Grep - A powerful search utility
 
Unit5 C
Unit5 C Unit5 C
Unit5 C
 
Unix command line concepts
Unix command line conceptsUnix command line concepts
Unix command line concepts
 
15 practical grep command examples in linux
15 practical grep command examples in linux15 practical grep command examples in linux
15 practical grep command examples in linux
 
Grep
GrepGrep
Grep
 
Spsl II unit
Spsl   II unitSpsl   II unit
Spsl II unit
 
Unix / Linux Command Reference
Unix / Linux Command ReferenceUnix / Linux Command Reference
Unix / Linux Command Reference
 
Pipes and filters
Pipes and filtersPipes and filters
Pipes and filters
 
Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014
 
2
22
2
 
Regular Expressions grep and egrep
Regular Expressions grep and egrepRegular Expressions grep and egrep
Regular Expressions grep and egrep
 
Unix Basics Commands
Unix Basics CommandsUnix Basics Commands
Unix Basics Commands
 
File management in C++
File management in C++File management in C++
File management in C++
 
Learning Grep
Learning GrepLearning Grep
Learning Grep
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystem
 
Linux
LinuxLinux
Linux
 
file management in c language
file management in c languagefile management in c language
file management in c language
 
Programming in C Session 4
Programming in C Session 4Programming in C Session 4
Programming in C Session 4
 
Linux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for BeginnersLinux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for Beginners
 

Similar to 08 text processing_tools

Scripting and the shell in LINUX
Scripting and the shell in LINUXScripting and the shell in LINUX
Scripting and the shell in LINUX
Bhushan Pawar -Java Trainer
 
Unit 8 text processing tools
Unit 8 text processing toolsUnit 8 text processing tools
Unit 8 text processing tools
root_fibo
 
grep.1.pdf
grep.1.pdfgrep.1.pdf
grep.1.pdf
Saravana Kumar
 
grep.1.pdf
grep.1.pdfgrep.1.pdf
grep.1.pdf
Saravana Kumar
 
Group13
Group13Group13
Linux Commands
Linux CommandsLinux Commands
Linux Commands
Utkarsh Sengar
 
Linux
LinuxLinux
101 3.7 search text files using regular expressions
101 3.7 search text files using regular expressions101 3.7 search text files using regular expressions
101 3.7 search text files using regular expressions
Acácio Oliveira
 
Commands and shell programming (3)
Commands and shell programming (3)Commands and shell programming (3)
Commands and shell programming (3)
christ university
 
AARAV NAYAN OPERATING SYSTEM LABORATORY PCA
AARAV NAYAN OPERATING SYSTEM LABORATORY PCAAARAV NAYAN OPERATING SYSTEM LABORATORY PCA
AARAV NAYAN OPERATING SYSTEM LABORATORY PCA
AaravNayan
 
Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions
Ahmed El-Arabawy
 
workshop_1.ppt
workshop_1.pptworkshop_1.ppt
workshop_1.ppt
hazhamina
 
1) List currently running jobsANS) see currently runningcommand.pdf
1) List currently running jobsANS) see currently runningcommand.pdf1) List currently running jobsANS) see currently runningcommand.pdf
1) List currently running jobsANS) see currently runningcommand.pdf
amaresh6333
 
Lecture_4.pdf
Lecture_4.pdfLecture_4.pdf
Lecture_4.pdf
SteveHuang50
 
linux OS.pptx
linux OS.pptxlinux OS.pptx
linux OS.pptx
Shinwa Hasan
 
intro unix/linux 05
intro unix/linux 05intro unix/linux 05
intro unix/linux 05
duquoi
 
3.7 search text files using regular expressions
3.7 search text files using regular expressions3.7 search text files using regular expressions
3.7 search text files using regular expressions
Acácio Oliveira
 
Unix Trainning Doc.pptx
Unix Trainning Doc.pptxUnix Trainning Doc.pptx
Unix Trainning Doc.pptx
KalpeshRaut7
 
Filters & Vi Editor
Filters & Vi EditorFilters & Vi Editor
Filters & Vi Editor
BIT DURG
 
Basic Linux Commands
Basic Linux CommandsBasic Linux Commands
Basic Linux Commands
BIT DURG
 

Similar to 08 text processing_tools (20)

Scripting and the shell in LINUX
Scripting and the shell in LINUXScripting and the shell in LINUX
Scripting and the shell in LINUX
 
Unit 8 text processing tools
Unit 8 text processing toolsUnit 8 text processing tools
Unit 8 text processing tools
 
grep.1.pdf
grep.1.pdfgrep.1.pdf
grep.1.pdf
 
grep.1.pdf
grep.1.pdfgrep.1.pdf
grep.1.pdf
 
Group13
Group13Group13
Group13
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
Linux
LinuxLinux
Linux
 
101 3.7 search text files using regular expressions
101 3.7 search text files using regular expressions101 3.7 search text files using regular expressions
101 3.7 search text files using regular expressions
 
Commands and shell programming (3)
Commands and shell programming (3)Commands and shell programming (3)
Commands and shell programming (3)
 
AARAV NAYAN OPERATING SYSTEM LABORATORY PCA
AARAV NAYAN OPERATING SYSTEM LABORATORY PCAAARAV NAYAN OPERATING SYSTEM LABORATORY PCA
AARAV NAYAN OPERATING SYSTEM LABORATORY PCA
 
Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions
 
workshop_1.ppt
workshop_1.pptworkshop_1.ppt
workshop_1.ppt
 
1) List currently running jobsANS) see currently runningcommand.pdf
1) List currently running jobsANS) see currently runningcommand.pdf1) List currently running jobsANS) see currently runningcommand.pdf
1) List currently running jobsANS) see currently runningcommand.pdf
 
Lecture_4.pdf
Lecture_4.pdfLecture_4.pdf
Lecture_4.pdf
 
linux OS.pptx
linux OS.pptxlinux OS.pptx
linux OS.pptx
 
intro unix/linux 05
intro unix/linux 05intro unix/linux 05
intro unix/linux 05
 
3.7 search text files using regular expressions
3.7 search text files using regular expressions3.7 search text files using regular expressions
3.7 search text files using regular expressions
 
Unix Trainning Doc.pptx
Unix Trainning Doc.pptxUnix Trainning Doc.pptx
Unix Trainning Doc.pptx
 
Filters & Vi Editor
Filters & Vi EditorFilters & Vi Editor
Filters & Vi Editor
 
Basic Linux Commands
Basic Linux CommandsBasic Linux Commands
Basic Linux Commands
 

More from Shay Cohen

Linux Performance Tunning Memory
Linux Performance Tunning MemoryLinux Performance Tunning Memory
Linux Performance Tunning Memory
Shay Cohen
 
Linux Performance Tunning Kernel
Linux Performance Tunning KernelLinux Performance Tunning Kernel
Linux Performance Tunning Kernel
Shay Cohen
 
Linux Performance Tunning introduction
Linux Performance Tunning introductionLinux Performance Tunning introduction
Linux Performance Tunning introduction
Shay Cohen
 
chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinux
Shay Cohen
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
Shay Cohen
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automation
Shay Cohen
 
14 network tools
14 network tools14 network tools
14 network tools
Shay Cohen
 
13 process management
13 process management13 process management
13 process management
Shay Cohen
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
Shay Cohen
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
Shay Cohen
 
10 finding files
10 finding files10 finding files
10 finding files
Shay Cohen
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editor
Shay Cohen
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissions
Shay Cohen
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipes
Shay Cohen
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bash
Shay Cohen
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
Shay Cohen
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usage
Shay Cohen
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copy
Shay Cohen
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overview
Shay Cohen
 

More from Shay Cohen (19)

Linux Performance Tunning Memory
Linux Performance Tunning MemoryLinux Performance Tunning Memory
Linux Performance Tunning Memory
 
Linux Performance Tunning Kernel
Linux Performance Tunning KernelLinux Performance Tunning Kernel
Linux Performance Tunning Kernel
 
Linux Performance Tunning introduction
Linux Performance Tunning introductionLinux Performance Tunning introduction
Linux Performance Tunning introduction
 
chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinux
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automation
 
14 network tools
14 network tools14 network tools
14 network tools
 
13 process management
13 process management13 process management
13 process management
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
 
10 finding files
10 finding files10 finding files
10 finding files
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editor
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissions
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipes
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bash
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usage
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copy
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overview
 

Recently uploaded

Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
flufftailshop
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 

Recently uploaded (20)

Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 

08 text processing_tools

  • 2. grep • ‘grep’ is used to search for strings and/or regular-expressions (REGEX) in other commands’ outputs or as a search tool on its own. • In order to search for a string within file, we can use:  # grep -i ’user1' /etc/passwd user1:x:500:500::/home/user1:/bin/bash • ‘grep’ will output the entire line in which the string we searched for was found, as seen in the example above.
  • 3. grep • grep has many options we can use; some of the common ones are:  -i : case-insensitive; do not mind upper or lower case.  -v : return anything that is NOT the string we’ve searched for.  -r / -R : recursive; search through sub-directories as well.  -q : suppress all normal output; useful when checking and evaluating in scripts. • For the full list of options, run: “grep --help” or “man grep”.
  • 4. grep • There are two more variants of grep:  fgrep – suited for string searches only; the searches are performed faster.  egrep – suited for extended regex searches. • grep can also be used as a filter, on the right side of pipes in order to display only specific outputs: # ls -l | grep “kf” -rw-rw-r-- 1 nir test 0 Jul 19 15:11 kfile9
  • 5. cut • The “cut” command is used to filter out either fields or columns of text. • Syntax:  cut [options] [filename(s)] • Options:  -f’[n]’ : [n] refers to field number(s); the fields must be separated by a delimiter.  -d’[delimiter]’ : this option defines which character in our string is the delimiter; if this option is not supplied by the user, the default will be used (TAB). # cut -f'6','7' -d':' /etc/passwd | grep user1 /home/user1:/bin/bash
  • 6. sort • The “sort” command enabled sorting of data in numerical or alphabetical orders. • Syntax:  sort [options] [filename(s)] • Options:  -m – merge already sorted files  -r - reverse sort order  -M – month name sort  -n – numeric sort  -u – unique sort; display only the first match of a repetitive string in the file, only once.
  • 7. uniq • The “uniq” command searches for duplicates line of data. • Syntax:  uniq [options] [filename(s)] • Options:  -u – show only lines that are not repeated  -d – show only one copy of the duplicate line  -c – output each line with the count of occurrences  -I – case-insensitive
  • 8. tr • The “tr” command is used to translate characters. It uses two sets of characters, given as command arguments and converts them on a char-to-char basis. Is can also:  Converts letter cases; upper to lower and vice-versa.  Recognizes special characters, such as n (newline)  Cannot open files; can only use data from pipes or redirections from within files. • Syntax:  tr [options] charter-list1 charter-list2 < [file] • Options:  -d – delete all characters appearing in “chars1”  -s - replace instances of repeated characters with a single character.  -cd – delete all characters that are NOT in “chars1”
  • 9. tail • The “tail” command prints the end of a file • Syntax:  tail [options] [filename(s)] • Options:  -n+N print the last N lines (default is 10)  -n-N print the entire file starting from line N  -f follow mode. tail will stay active and update on each new line to the file
  • 10. head • The “head” command prints the start of a file • Syntax:  head [options] [filename(s)] • Options:  -n+N print the first N lines (default is 10)  -n-N print the entire file until the Nth line

Editor's Notes

  1. Exrcise: Print out a list of users and their home directories
  2. Exrcise: sort users by Group ID. again, man sort
  3. Exercise: Use two terminals to examine the ‘tail -f’ option