Chapter 10 Advanced file processing

Slides:



Advertisements
Similar presentations
UNIX Chapter 10 Advanced File Processing Mr. Mohammad Smirat.
Advertisements

There are three types of users in linux  System users: (they are the software/applications users created automatically by the system) e.g mail, MySQL,
การใช้ระบบปฏิบัติการ UNIX พื้นฐาน บทที่ 4 File Manipulation วิบูลย์ วราสิทธิชัย นักวิชาการคอมพิวเตอร์ ศูนย์คอมพิวเตอร์ ม. สงขลานครินทร์ เวอร์ชั่น 1 วันที่
LINUX System : Lecture 3 (English-Only Lecture) Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University Acknowledgement.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
CS 497C – Introduction to UNIX Lecture 13: - The File System Chin-Chih Chang
Linux+ Guide to Linux Certification, Third Edition Chapter 11 Compression, System Backup, and Software Installation.
CSCI 330 T HE UNIX S YSTEM File operations. OPERATIONS ON REGULAR FILES 2 CSCI The UNIX System Create Edit Display Contents Display Contents Print.
UNIX. find command ● The find command is used to locate files on a Unix or Linux system. find will search any set of directories you specify for files.
Linux Commands LINUX COMMANDS.
Review for Exam 1 Exam 1 on June 24 CSC 3320.
Chapter 4: UNIX File Processing Input and Output.
MCB Lecture #3 Sept 2/14 Intro to UNIX terminal.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II CHAPTER 10: ADVANCED FILE PROCESSING.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Chapter 3: Command Line Utilities Doin’ stuff. In this chapter … Special characters Redirection More utilities than you shake a stick at.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
A Guide to Unix Using Linux Fourth Edition
Unix programming Term: III B.Tech II semester Unit-II PPT Slides Text Books: (1)unix the ultimate guide by Sumitabha Das (2)Advanced programming.
Dedan Githae, BecA-ILRI Hub Introduction to Linux / UNIX OS MARI eBioKit Workshop; Nov , 2014.
Linux+ Guide to Linux Certification, Third Edition
LINUX Tuesday, 5 July :00 pm. Remote Login l Use Secure Shell (ssh) l Machine name/IP address E.g. ssh hydra.sma.nus.edu.sg Or ssh
Find Find basics. find ~ -name myfile –print find directory criteria This will search the home directory (~) looking for files.
1 Lecture 5 Additional useful commands COP 3353 Introduction to UNIX.
Summer 2015 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to UNIX / Linux - 6 Dr. Jerry Shiao, Silicon Valley University.
1 Day 5 Additional Unix Commands. 2 Important vs. Not Often in Unix there are multiple ways to do something. –In this class, we will learn the important.
Chapter 10 Advanced File Processing. Regular Expressions A compact notation for representing patterns in strings Used by many common Linux utilities such.
Week 3 Exploring Linux Filesystems. Objectives  Understand and navigate the Linux directory structure using relative and absolute pathnames  Describe.
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 10 Linux.
L&T Infotech1 UNIX – Getting Started - Aneesh Ramani.
Introduction to Linux Instructor: Bennett M. Tanyag PART – 3 Unit 1.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
By Corey Stokes 9/14/10. What is grep? Global Regular Expression Print grep is a command line search utility in Unix Try: Search for a word in a.cpp file.
CSC414 “Introduction to UNIX/ Linux” Lecture 5. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Basic of UNIX For fresh members of SPARCS
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Unix Fundamentals CS 127. File navigation cd - change directory cd /var/log cd /etc/apache2 cd ~/Desktop ~ is a shortcut for the home directory.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Unix Tools Tawatchai Iempairote November 22, 2011.
PROGRAMMING THE BASH SHELL PART III by İlker Korkmaz and Kaya Oğuz
Linux 201 Training Module Linux Adv File Mgmt.
Tutorial of Unix Command & shell scriptS 5027
Lesson 5-Exploring Utilities
LINUX LANGUAGE MULTIPLE CHOICE QUESTION SET-5
Advanced File Processing
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
The UNIX Shell Learning Objectives:
C151 Multi-User Operating Systems
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands:
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Guide To UNIX Using Linux Third Edition
The Linux Command Line Chapter 18
Tutorial of Unix Command & shell scriptS 5027
Chapter 7 File and file System structure
Lecture 5 Additional useful commands COP 3353 Introduction to UNIX 1.
Chapter Four UNIX File Processing.
Tutorial Unix Command & Makefile CIS 5027
CIS 155 Lecture 10, Farewell to UNIX
Prepared by, Mr. Satish Pise
The Emacs Editor Read: Forouzan, Appendix C
Linux Commands LINUX COMMANDS.
2011年 5月 2011年 6月 2011年 7月 2011年 8月 Sunday Monday Tuesday Wednesday
Lecture 5 Additional useful commands COP 3353 Introduction to UNIX 1.
Presentation transcript:

Chapter 10 Advanced file processing

Commands Regular Expressions/special characters/Meta characters rm file* -It will remove all the files starting from the name file no matter how lengthy there name is, will remove file1, file111, fileabc43er, fileg * is a meta character which has a special meaning behind it (meaning every thing) rm file? -It will remove all the files starting from the name file and just one more extra character in the name, will remove file1, fileB, filec, file8. ? again is a meta character which has a special meaning behind it (meaning just one character or letter), it acts like a fill in the blank rm f?l? -It will remove all the files starting with the first letter f and the second may be any character/number ,third letter must be l and fourth may be any character/number f just one more, will remove file, fBl2, f5l7, f9le, f3lg. just one character or letter), it acts like a fill in the blank, in this example there are two fill in the blanks ^ beginning of line $ End of line

Compressing a file compress option uncompress extension limitations compress -v,f uncompress .Z gzip -v,t,f,r,d gunzip .gz gzexe(executable) -d gzexe -d ~(with the previous state and a backup) pack unpack .z not applicable on a file greater than 8MB size

Compressing a file compress compress filea uncompress filea.Z compress -v filea fileb filec uncompress -fv filea.Z fileb.Z

Compressing a file gzip gzip file22 gunzip file22.gz Directory gzip -v –f –r dirA gunzip -r dirA.gz

Compressing a file compress an executable file gzexe banner ls –l 764 banner 1054 banner~ a backup of precious state gzexe –d banner 764 banner~ a backup of precious state 1054 banner

Compressing a file pack pack filea unpack filea.z

Reading a compressed file gzip file22 more file22.gz 9843j3409j09&$%^$%dsfgs%$6dfsgdf 435DSFg456$%7!@@!@2ffg hjUu74(()g^^345Gdf#@$%&^&*(&$ER %$^$#NGFf cat file22.gz

Reading a compressed file zmore file22.gz We should always respect our parents and teachers. We will obey Allah because Allah love us more then 70 Times than our real mother zcat file22.gz We should always respect our parents and teachers

Sorting a file sort naughty_students cat naughty_students Daud Khan d.k@hotmail.com 546372 Usman Raza usman@yahoo.com 896574 Ali Sultan A.rashid@aol.com 854977 Bilal Malik bilal.m@yahoo.com 789475 Zubair Ameen zubair.a@gmail.com 115889 sort naughty_students Ali Sultan A.rashid@aol.com 854977 Bilal Malik bilal.m@yahoo.com 789475 Daud Khan d.k@hotmail.com 546372 Usman Raza usman@yahoo.com 896574 Zubair Ameen zubair.a@gmail.com 115889

Sorting a file sort +1 naughty_students cat naughty_students Daud Khan d.k@hotmail.com 546372 Usman Raza usman@yahoo.com 896574 Ali Sultan A.rashid@aol.com 854977 Bilal Malik bilal.m@yahoo.com 789475 Zubair Ameen zubair.a@gmail.com 115889 sort +1 naughty_students Zubair Ameen zubair.a@gmail.com 115889 Daud Khan d.k@hotmail.com 546372 Bilal Malik bilal.m@yahoo.com 789475 Usman Raza usman@yahoo.com 896574 Ali Sultan A.rashid@aol.com 854977

Sorting a file sort +2 -r –b naughty_students cat naughty_students Daud Khan d.k@hotmail.com 546372 Usman Raza usman@yahoo.com 896574 Ali Sultan A.rashid@aol.com 854977 Bilal Malik bilal.m@yahoo.com 789475 Zubair Ameen zubair.a@gmail.com 115889 sort +2 -r –b naughty_students Zubair Ameen zubair.a@gmail.com 115889 Usman Raza usman@yahoo.com 896574 Daud Khan d.k@hotmail.com 546372 Bilal Malik bilal.m@yahoo.com 789475 Ali Sultan A.rashid@aol.com 854977

Searching a file in Unix directory structire command: find find /home -name pakistan.gif -print Command to Find a file Searching location Indicate that next work is the actual name of a file Name of the file that is to be searched Print the result on the screen command: whereis whereis ftp tar ls

Searching a pattern in a file cat naughty_students Daud Khan d.k@hotmail.com 546372 Usman Raza usman@yahoo.com 896574 Ali Sultan A.rashid@aol.com 854977 Bilal Malik bilal.m@yahoo.com 789475 Zubair Ameen zubair.a@gmail.com 115889 grep Raza naughty_students Usman Raza usman@yahoo.com 896574 grep –n Raza naughty_students 2 Usman Raza usman@yahoo.com 896574

Searching a pattern in a file cat naughty_students Daud Khan d.k@hotmail.com 546372 Usman Raza usman@yahoo.com 896574 Ali Sultan A.rashid@aol.com 854977 Bilal Malik bilal.m@yahoo.com 789475 Zubair Ameen zubair.a@gmail.com 115889 grep ‘^[A-D]’ naughty_students Daud Khan d.k@hotmail.com 546372 Ali Sultan A.rashid@aol.com 854977 Bilal Malik bilal.m@yahoo.com 789475 grep ‘\<A’ naughty_students Ali Sultan A.rashid@aol.com 854977 Zubair Ameen zubair.a@gmail.com 115889

Searching a pattern in a file cat naughty_students Daud Khan d.k@hotmail.com 546372 Usman Raza usman@yahoo.com 896574 Ali Sultan A.rashid@aol.com 854977 Bilal Malik bilal.m@yahoo.com 789475 Zubair Ameen zubair.a@gmail.com 115889 egrep -n “Ali|Ameen” naughty_students 3 Ali Sultan A.rashid@aol.com 854977 5 Zubair Ameen zubair.a@gmail.com 115889 egrep -v “Ali|Ameen” naughty_students Daud Khan d.k@hotmail.com 546372 Usman Raza usman@yahoo.com 896574 Bilal Malik bilal.m@yahoo.com 789475

Searching a pattern in a file fgrep: very good speed but not so flexible grep : good speed and flexible egrep: slow speed but very flexible

Sorting a file cut -fr 1,2 naughty_students cat naughty_students Daud Khan d.k@hotmail.com 546372 Usman Raza usman@yahoo.com 896574 Ali Sultan A.rashid@aol.com 854977 Bilal Malik bilal.m@yahoo.com 789475 Zubair Ameen zubair.a@gmail.com 115889 cut -fr 1,2 naughty_students Zubair Ameen Daud Khan Bilal Malik Usman Raza Ali Sultan

Sorting a file cut -f1,2,4 naughty_students cat naughty_students Daud Khan d.k@hotmail.com 546372 Usman Raza usman@yahoo.com 896574 Ali Sultan A.rashid@aol.com 854977 Bilal Malik bilal.m@yahoo.com 789475 Zubair Ameen zubair.a@gmail.com 115889 cut -f1,2,4 naughty_students Daud Khan 546372 Usman Raza 896574 Ali Sultan 854977 Bilal Malik 789475 Zubair Ameen 115889

cut and paste cat Course paste naughty_students Course cat naughty_students Daud Khan d.k@hotmail.com 546372 Usman Raza usman@yahoo.com 896574 Ali Sultan A.rashid@aol.com 854977 Bilal Malik bilal.m@yahoo.com 789475 Zubair Ameen zubair.a@gmail.com 115889 cat Course monday Unix Friday Php Tuesday Java Saturday Linux Thursday oops paste naughty_students Course Daud Khan d.k@hotmail.com 546372 monday Unix Usman Raza usman@yahoo.com 896574 Friday Php Ali Sultan A.rashid@aol.com 854977 Tuesday Java Bilal Malik bilal.m@yahoo.com 789475 Saturday Linux Zubair Ameen zubair.a@gmail.com 115889 Thursday oops

Encrypt a file crypt key < original_file > encrypted_file crypt key < encrypted_file > original_file crypt hskr45@ < myfile > secretfile (encrypting) crypt hskr45@ < secretfile > myfile (decrypting)