SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Downloaden Sie, um offline zu lesen
Chapter 5Chapter 5
Text FilteringText Filtering
Ref. Pge. 19
Text FilteringText Filtering
●
Process text file onlyProcess text file only
●
No modification to origin by defaultNo modification to origin by default
●
Usually used in pipe lineUsually used in pipe line
●
Many tools and various waysMany tools and various ways
●
Set locale toSet locale to LANG=POSIXLANG=POSIX
Preparation for PracticePreparation for Practice
nano my.filenano my.file
abcabc XYZXYZ
aaa   bbbaaa   bbb
1212 aaaa
110   BB110   BB
Tab
Space
Blank
Tab
Space
UsingUsing catcat
●
cat <text_file>cat <text_file>
– Display the content of an ASCII text file inDisplay the content of an ASCII text file in
onceonce
●
tac <text_file>tac <text_file>
– Same as cat, but in revers line orderSame as cat, but in revers line order
Ref. Pge. 19
UsingUsing joinjoin
●
join file1 file2join file1 file2
– Combine lines on a common fieldCombine lines on a common field
– Common optionsCommon options
●
­­1 1 nn ­2  ­2 mm : specify common field: the field: specify common field: the field nn inin
file1 and the filefile1 and the file mm in file2in file2
Ref. Pge. 20
UsingUsing pastepaste
●
paste file1 file2paste file1 file2
– Combine lines without common fieldCombine lines without common field
Ref. Pge. 21
UsingUsing odod
●
od <text_file>od <text_file>
– Display in octal formatDisplay in octal format
– Common optionsCommon options
●
­­aa : display unprintable characters in name: display unprintable characters in name
●
­­cc : display unprintable characters in escape: display unprintable characters in escape
Ref. Pge. 22
UsingUsing sortsort
●
sort <text_file>sort <text_file>
– Resort lines according to ASCII orderResort lines according to ASCII order
– Common optionsCommon options
●
­k ­k nn : start sorting from field: start sorting from field nn
●
­t ­t ss : specify field separator: specify field separator
●
­r­r : revers order: revers order
●
­u­u : suppress duplicate lines: suppress duplicate lines
●
­n­n : sorted by numbers first: sorted by numbers first
Ref. Pge. 22
UsingUsing trtr
●
tr set1 set2 <text_file>tr set1 set2 <text_file>
– Translate characters in set1 to set2Translate characters in set1 to set2
– According to positionAccording to position
– Common optionsCommon options
●
­­s sets set : suppress duplicate characters in set: suppress duplicate characters in set
●
­­d setd set : delete all characters in set: delete all characters in set
Ref. Pge. 23
UsingUsing expandexpand andand unexpandunexpand
●
expand <text_file>expand <text_file>
– ConvertConvert tabtab intointo spacesspaces
●
unexpand ­a <text_file>unexpand ­a <text_file>
– ConvertConvert spacesspaces intointo tabtab
Ref. Pge. 21&24
UsingUsing moremore andand lessless
●
more <text_file>more <text_file>
– Display the content of an ASCII text file pageDisplay the content of an ASCII text file page
by pageby page
●
less <text_file>less <text_file>
– Same as more, with more navigating andSame as more, with more navigating and
searching functionssearching functions
Ref. Pge. 29
UsingUsing uniquniq
●
uniq <text_file>uniq <text_file>
– Suppress duplicate linesSuppress duplicate lines
– Common optionsCommon options
●
­c­c : counter line existence: counter line existence
Ref. Pge. 24
UsingUsing fmtfmt
●
fmt <text_file>fmt <text_file>
– Reformat paragraphReformat paragraph
– Common optionsCommon options
●
­w ­w nn : paragraph width: paragraph width
Ref. Pge. 25
UsingUsing nlnl
●
nl <text_file>nl <text_file>
– Numbering each line except blanksNumbering each line except blanks
– Common optionsCommon options
●
­ba­ba : numbering blank lines as well: numbering blank lines as well
Ref. Pge. 25
UsingUsing prpr
●
pr <text_file>pr <text_file>
– Display in printing formatDisplay in printing format
Ref. Pge. 27
UsingUsing headhead andand tailtail
●
head <text_file>head <text_file>
– Display the top 10 lines of a text fileDisplay the top 10 lines of a text file
– Common options:Common options:
●
­­nn : top: top nn lineslines
●
tail <text_file>tail <text_file>
– Display the bottom 10 lines of a text fileDisplay the bottom 10 lines of a text file
– Common options:Common options:
●
­­n n  : bottom: bottom nn lineslines
●
­n +­n +nn  : from the: from the nn to bottom linesto bottom lines
●
­f ­f : stay in displaying until press: stay in displaying until press ctrl­cctrl­c
Ref. Pge. 28
UsingUsing cutcut
●
cut <option> <text_file>cut <option> <text_file>
– Cut out sections from each line of fileCut out sections from each line of file
– Common options:Common options:
●
­c­c  nn­­mm : cut characters from: cut characters from nn toto mm
●
­f­f  nn­­mm : cut fields from: cut fields from nn toto mm
●
­d­d  ss : specify field separator (default:: specify field separator (default: tabtab))
Ref. Pge. 30
UsingUsing wcwc
●
wc <text_file>wc <text_file>
– Calculate counters of line, word, and characterCalculate counters of line, word, and character
– Common options:Common options:
●
­l­l : calculate line only: calculate line only
●
­w­w : calculate word only: calculate word only
●
­c­c : calculate character only: calculate character only
Ref. Pge. 31
UsingUsing diffdiff
●
diff file1 file2diff file1 file2
– Compare files line by lineCompare files line by line
– Common options:Common options:
●
­­rr : compare directories: compare directories
●
­­NN : treat absent files as empty: treat absent files as empty
●
­­uu : show unified context: show unified context
UsingUsing patchpatch
●
patch < patchfilepatch < patchfile
– Apply aApply a diffdiff file to an originafile to an origina
– Common options:Common options:
●
­­p p nn : ignore the: ignore the nn of / in context pathof / in context path

Weitere ähnliche Inhalte

Was ist angesagt?

Archiving in linux tar
Archiving in linux tarArchiving in linux tar
Archiving in linux tarInfoExcavator
 
101 3.5 create, monitor and kill processes
101 3.5 create, monitor and kill processes101 3.5 create, monitor and kill processes
101 3.5 create, monitor and kill processesAcácio Oliveira
 
淺入淺出 GDB
淺入淺出 GDB淺入淺出 GDB
淺入淺出 GDBJim Chang
 
Linux basics and commands - from lynxbee.com
Linux basics and commands - from lynxbee.comLinux basics and commands - from lynxbee.com
Linux basics and commands - from lynxbee.comGreen Ecosystem
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisKnoldus Inc.
 
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres OpenKevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres OpenPostgresOpen
 
TLPI - Chapter 44 Pipe and Fifos
TLPI - Chapter 44 Pipe and FifosTLPI - Chapter 44 Pipe and Fifos
TLPI - Chapter 44 Pipe and FifosShu-Yu Fu
 
Unit 10 investigating and managing
Unit 10 investigating and managingUnit 10 investigating and managing
Unit 10 investigating and managingroot_fibo
 
Pipes and filters
Pipes and filtersPipes and filters
Pipes and filtersbhatvijetha
 
Mastering the Unix Command Line
Mastering the Unix Command LineMastering the Unix Command Line
Mastering the Unix Command LineHoward Mao
 
3.2 process text streams using filters
3.2 process text streams using filters3.2 process text streams using filters
3.2 process text streams using filtersAcácio Oliveira
 
Linux administration training
Linux administration trainingLinux administration training
Linux administration trainingiman darabi
 
Unix Command Line Productivity Tips
Unix Command Line Productivity TipsUnix Command Line Productivity Tips
Unix Command Line Productivity TipsKeith Bennett
 
Linux commd
Linux commdLinux commd
Linux commdragav03
 
Linux commd
Linux commdLinux commd
Linux commdragav03
 

Was ist angesagt? (19)

50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
Backup and-recovery2
Backup and-recovery2Backup and-recovery2
Backup and-recovery2
 
Rpm Introduction
Rpm IntroductionRpm Introduction
Rpm Introduction
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
Archiving in linux tar
Archiving in linux tarArchiving in linux tar
Archiving in linux tar
 
101 3.5 create, monitor and kill processes
101 3.5 create, monitor and kill processes101 3.5 create, monitor and kill processes
101 3.5 create, monitor and kill processes
 
淺入淺出 GDB
淺入淺出 GDB淺入淺出 GDB
淺入淺出 GDB
 
Linux basics and commands - from lynxbee.com
Linux basics and commands - from lynxbee.comLinux basics and commands - from lynxbee.com
Linux basics and commands - from lynxbee.com
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres OpenKevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
 
TLPI - Chapter 44 Pipe and Fifos
TLPI - Chapter 44 Pipe and FifosTLPI - Chapter 44 Pipe and Fifos
TLPI - Chapter 44 Pipe and Fifos
 
Unit 10 investigating and managing
Unit 10 investigating and managingUnit 10 investigating and managing
Unit 10 investigating and managing
 
Pipes and filters
Pipes and filtersPipes and filters
Pipes and filters
 
Mastering the Unix Command Line
Mastering the Unix Command LineMastering the Unix Command Line
Mastering the Unix Command Line
 
3.2 process text streams using filters
3.2 process text streams using filters3.2 process text streams using filters
3.2 process text streams using filters
 
Linux administration training
Linux administration trainingLinux administration training
Linux administration training
 
Unix Command Line Productivity Tips
Unix Command Line Productivity TipsUnix Command Line Productivity Tips
Unix Command Line Productivity Tips
 
Linux commd
Linux commdLinux commd
Linux commd
 
Linux commd
Linux commdLinux commd
Linux commd
 

Andere mochten auch

Linux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementLinux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementKenny (netman)
 
Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgKenny (netman)
 
Linux fundamental - Chap 02 perm
Linux fundamental - Chap 02 permLinux fundamental - Chap 02 perm
Linux fundamental - Chap 02 permKenny (netman)
 
Importance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingImportance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingKenny (netman)
 
Linux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procLinux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procKenny (netman)
 
Linux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fsLinux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fsKenny (netman)
 
The linux command line for total beginners
The linux command line  for total beginnersThe linux command line  for total beginners
The linux command line for total beginnersCorrie Watt
 
Linux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viLinux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viKenny (netman)
 
Ras pioverview
Ras pioverviewRas pioverview
Ras pioverviewAlec Clews
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08Tushar Jain
 
Linux pipe & redirection
Linux pipe & redirectionLinux pipe & redirection
Linux pipe & redirectionColin Su
 
Linux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueLinux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueKenny (netman)
 
Linux fundamental - Chap 03 file
Linux fundamental - Chap 03 fileLinux fundamental - Chap 03 file
Linux fundamental - Chap 03 fileKenny (netman)
 
Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on praticeKenny (netman)
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentalschakrikolla
 

Andere mochten auch (20)

Linux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementLinux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account management
 
Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkg
 
Linux fundamental - Chap 02 perm
Linux fundamental - Chap 02 permLinux fundamental - Chap 02 perm
Linux fundamental - Chap 02 perm
 
Importance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingImportance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation reading
 
Windows7 Vs Linux
Windows7 Vs LinuxWindows7 Vs Linux
Windows7 Vs Linux
 
Linux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procLinux fundamental - Chap 08 proc
Linux fundamental - Chap 08 proc
 
Linux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fsLinux fundamental - Chap 10 fs
Linux fundamental - Chap 10 fs
 
Linux CLI
Linux CLILinux CLI
Linux CLI
 
The linux command line for total beginners
The linux command line  for total beginnersThe linux command line  for total beginners
The linux command line for total beginners
 
Linux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viLinux fundamental - Chap 07 vi
Linux fundamental - Chap 07 vi
 
Ras pioverview
Ras pioverviewRas pioverview
Ras pioverview
 
Chap 17 advfs
Chap 17 advfsChap 17 advfs
Chap 17 advfs
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
 
Linux pipe & redirection
Linux pipe & redirectionLinux pipe & redirection
Linux pipe & redirection
 
Chap 18 net
Chap 18 netChap 18 net
Chap 18 net
 
Linux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueLinux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System Rescue
 
Linux fundamental - Chap 03 file
Linux fundamental - Chap 03 fileLinux fundamental - Chap 03 file
Linux fundamental - Chap 03 file
 
Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on pratice
 
Basics of-linux
Basics of-linuxBasics of-linux
Basics of-linux
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentals
 

Ähnlich wie Linux fundamental - Chap 05 filter

Unit 8 text processing tools
Unit 8 text processing toolsUnit 8 text processing tools
Unit 8 text processing toolsroot_fibo
 
AARAV NAYAN OPERATING SYSTEM LABORATORY PCA
AARAV NAYAN OPERATING SYSTEM LABORATORY PCAAARAV NAYAN OPERATING SYSTEM LABORATORY PCA
AARAV NAYAN OPERATING SYSTEM LABORATORY PCAAaravNayan
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_toolsShay Cohen
 
workshop_1.ppt
workshop_1.pptworkshop_1.ppt
workshop_1.ppthazhamina
 
SGN Introduction to UNIX Command-line 2015 part 2
SGN Introduction to UNIX Command-line 2015 part 2SGN Introduction to UNIX Command-line 2015 part 2
SGN Introduction to UNIX Command-line 2015 part 2solgenomics
 
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 expressionsAcácio Oliveira
 
Unix Trainning Doc.pptx
Unix Trainning Doc.pptxUnix Trainning Doc.pptx
Unix Trainning Doc.pptxKalpeshRaut7
 
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 expressionsAcácio Oliveira
 
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 expressionsAcácio Oliveira
 
Linux tech talk
Linux tech talkLinux tech talk
Linux tech talkPrince Raj
 

Ähnlich wie Linux fundamental - Chap 05 filter (20)

Unit 8 text processing tools
Unit 8 text processing toolsUnit 8 text processing tools
Unit 8 text processing tools
 
AARAV NAYAN OPERATING SYSTEM LABORATORY PCA
AARAV NAYAN OPERATING SYSTEM LABORATORY PCAAARAV NAYAN OPERATING SYSTEM LABORATORY PCA
AARAV NAYAN OPERATING SYSTEM LABORATORY PCA
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_tools
 
Linux com
Linux comLinux com
Linux com
 
Rhel2
Rhel2Rhel2
Rhel2
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
workshop_1.ppt
workshop_1.pptworkshop_1.ppt
workshop_1.ppt
 
SGN Introduction to UNIX Command-line 2015 part 2
SGN Introduction to UNIX Command-line 2015 part 2SGN Introduction to UNIX Command-line 2015 part 2
SGN Introduction to UNIX Command-line 2015 part 2
 
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
 
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
 
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
 
Linux tech talk
Linux tech talkLinux tech talk
Linux tech talk
 
Buffer manager
Buffer managerBuffer manager
Buffer manager
 
Vim
VimVim
Vim
 
Vim and Python
Vim and PythonVim and Python
Vim and Python
 
Group13
Group13Group13
Group13
 

Mehr von Kenny (netman)

rpi_audio configuration steps
rpi_audio configuration stepsrpi_audio configuration steps
rpi_audio configuration stepsKenny (netman)
 
Linux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job SchedulingLinux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job SchedulingKenny (netman)
 
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptKenny (netman)
 
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementLinux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementKenny (netman)
 
Linux fundamental - Chap 11 boot
Linux fundamental - Chap 11 bootLinux fundamental - Chap 11 boot
Linux fundamental - Chap 11 bootKenny (netman)
 
Linux fundamental - Chap 04 archive
Linux fundamental - Chap 04 archiveLinux fundamental - Chap 04 archive
Linux fundamental - Chap 04 archiveKenny (netman)
 
Linux Network Monitoring
Linux Network MonitoringLinux Network Monitoring
Linux Network MonitoringKenny (netman)
 

Mehr von Kenny (netman) (15)

rpi_audio configuration steps
rpi_audio configuration stepsrpi_audio configuration steps
rpi_audio configuration steps
 
Rpi audio
Rpi audioRpi audio
Rpi audio
 
Ha opensuse
Ha opensuseHa opensuse
Ha opensuse
 
Chap 19 web
Chap 19 webChap 19 web
Chap 19 web
 
About the Course
About the CourseAbout the Course
About the Course
 
Linux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job SchedulingLinux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job Scheduling
 
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell script
 
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementLinux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware Management
 
Linux fundamental - Chap 11 boot
Linux fundamental - Chap 11 bootLinux fundamental - Chap 11 boot
Linux fundamental - Chap 11 boot
 
Linux fundamental - Chap 04 archive
Linux fundamental - Chap 04 archiveLinux fundamental - Chap 04 archive
Linux fundamental - Chap 04 archive
 
Linux system security
Linux system securityLinux system security
Linux system security
 
Linux Network Monitoring
Linux Network MonitoringLinux Network Monitoring
Linux Network Monitoring
 
加密應用(GPG)
加密應用(GPG)加密應用(GPG)
加密應用(GPG)
 
金鑰管理 (PKI)
金鑰管理 (PKI)金鑰管理 (PKI)
金鑰管理 (PKI)
 
Linux firewall
Linux firewallLinux firewall
Linux firewall
 

Kürzlich hochgeladen

ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 

Kürzlich hochgeladen (20)

ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 

Linux fundamental - Chap 05 filter

  • 1. Chapter 5Chapter 5 Text FilteringText Filtering Ref. Pge. 19
  • 2. Text FilteringText Filtering ● Process text file onlyProcess text file only ● No modification to origin by defaultNo modification to origin by default ● Usually used in pipe lineUsually used in pipe line ● Many tools and various waysMany tools and various ways ● Set locale toSet locale to LANG=POSIXLANG=POSIX
  • 3. Preparation for PracticePreparation for Practice nano my.filenano my.file abcabc XYZXYZ aaa   bbbaaa   bbb 1212 aaaa 110   BB110   BB Tab Space Blank Tab Space
  • 4. UsingUsing catcat ● cat <text_file>cat <text_file> – Display the content of an ASCII text file inDisplay the content of an ASCII text file in onceonce ● tac <text_file>tac <text_file> – Same as cat, but in revers line orderSame as cat, but in revers line order Ref. Pge. 19
  • 5. UsingUsing joinjoin ● join file1 file2join file1 file2 – Combine lines on a common fieldCombine lines on a common field – Common optionsCommon options ● ­­1 1 nn ­2  ­2 mm : specify common field: the field: specify common field: the field nn inin file1 and the filefile1 and the file mm in file2in file2 Ref. Pge. 20
  • 6. UsingUsing pastepaste ● paste file1 file2paste file1 file2 – Combine lines without common fieldCombine lines without common field Ref. Pge. 21
  • 7. UsingUsing odod ● od <text_file>od <text_file> – Display in octal formatDisplay in octal format – Common optionsCommon options ● ­­aa : display unprintable characters in name: display unprintable characters in name ● ­­cc : display unprintable characters in escape: display unprintable characters in escape Ref. Pge. 22
  • 8. UsingUsing sortsort ● sort <text_file>sort <text_file> – Resort lines according to ASCII orderResort lines according to ASCII order – Common optionsCommon options ● ­k ­k nn : start sorting from field: start sorting from field nn ● ­t ­t ss : specify field separator: specify field separator ● ­r­r : revers order: revers order ● ­u­u : suppress duplicate lines: suppress duplicate lines ● ­n­n : sorted by numbers first: sorted by numbers first Ref. Pge. 22
  • 9. UsingUsing trtr ● tr set1 set2 <text_file>tr set1 set2 <text_file> – Translate characters in set1 to set2Translate characters in set1 to set2 – According to positionAccording to position – Common optionsCommon options ● ­­s sets set : suppress duplicate characters in set: suppress duplicate characters in set ● ­­d setd set : delete all characters in set: delete all characters in set Ref. Pge. 23
  • 10. UsingUsing expandexpand andand unexpandunexpand ● expand <text_file>expand <text_file> – ConvertConvert tabtab intointo spacesspaces ● unexpand ­a <text_file>unexpand ­a <text_file> – ConvertConvert spacesspaces intointo tabtab Ref. Pge. 21&24
  • 11. UsingUsing moremore andand lessless ● more <text_file>more <text_file> – Display the content of an ASCII text file pageDisplay the content of an ASCII text file page by pageby page ● less <text_file>less <text_file> – Same as more, with more navigating andSame as more, with more navigating and searching functionssearching functions Ref. Pge. 29
  • 12. UsingUsing uniquniq ● uniq <text_file>uniq <text_file> – Suppress duplicate linesSuppress duplicate lines – Common optionsCommon options ● ­c­c : counter line existence: counter line existence Ref. Pge. 24
  • 13. UsingUsing fmtfmt ● fmt <text_file>fmt <text_file> – Reformat paragraphReformat paragraph – Common optionsCommon options ● ­w ­w nn : paragraph width: paragraph width Ref. Pge. 25
  • 14. UsingUsing nlnl ● nl <text_file>nl <text_file> – Numbering each line except blanksNumbering each line except blanks – Common optionsCommon options ● ­ba­ba : numbering blank lines as well: numbering blank lines as well Ref. Pge. 25
  • 15. UsingUsing prpr ● pr <text_file>pr <text_file> – Display in printing formatDisplay in printing format Ref. Pge. 27
  • 16. UsingUsing headhead andand tailtail ● head <text_file>head <text_file> – Display the top 10 lines of a text fileDisplay the top 10 lines of a text file – Common options:Common options: ● ­­nn : top: top nn lineslines ● tail <text_file>tail <text_file> – Display the bottom 10 lines of a text fileDisplay the bottom 10 lines of a text file – Common options:Common options: ● ­­n n  : bottom: bottom nn lineslines ● ­n +­n +nn  : from the: from the nn to bottom linesto bottom lines ● ­f ­f : stay in displaying until press: stay in displaying until press ctrl­cctrl­c Ref. Pge. 28
  • 17. UsingUsing cutcut ● cut <option> <text_file>cut <option> <text_file> – Cut out sections from each line of fileCut out sections from each line of file – Common options:Common options: ● ­c­c  nn­­mm : cut characters from: cut characters from nn toto mm ● ­f­f  nn­­mm : cut fields from: cut fields from nn toto mm ● ­d­d  ss : specify field separator (default:: specify field separator (default: tabtab)) Ref. Pge. 30
  • 18. UsingUsing wcwc ● wc <text_file>wc <text_file> – Calculate counters of line, word, and characterCalculate counters of line, word, and character – Common options:Common options: ● ­l­l : calculate line only: calculate line only ● ­w­w : calculate word only: calculate word only ● ­c­c : calculate character only: calculate character only Ref. Pge. 31
  • 19. UsingUsing diffdiff ● diff file1 file2diff file1 file2 – Compare files line by lineCompare files line by line – Common options:Common options: ● ­­rr : compare directories: compare directories ● ­­NN : treat absent files as empty: treat absent files as empty ● ­­uu : show unified context: show unified context
  • 20. UsingUsing patchpatch ● patch < patchfilepatch < patchfile – Apply aApply a diffdiff file to an originafile to an origina – Common options:Common options: ● ­­p p nn : ignore the: ignore the nn of / in context pathof / in context path