6 Pages

lab02

Course: CS 3308, Fall 2004
School: Colorado
Rating:
 
 
 
 
 

Word Count: 1537

Document Preview

#2 Lab Find and Grep Due in Lab, September 8, 2004 Name: Lab Time: Grade: Find The nd command is used to locate les in a le system. The nd command starts at a single directory and descends recursively into all of its subdirectories to locate les. The nd command is very useful, but it has an obscure syntax that can be hard to understand. The format of the nd command is as follows: find path operators Type the...

Register Now

Unformatted Document Excerpt

Coursehero >> Colorado >> Colorado >> CS 3308

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
#2 Lab Find and Grep Due in Lab, September 8, 2004 Name: Lab Time: Grade: Find The nd command is used to locate les in a le system. The nd command starts at a single directory and descends recursively into all of its subdirectories to locate les. The nd command is very useful, but it has an obscure syntax that can be hard to understand. The format of the nd command is as follows: find path operators Type the following: find ~/csci3308 -print -print is an operator that prints the le name of a le. The directory ~/csci3308 says to start from that directory and apply -print to every le in every directory below it. This will print a lot of les, and could also be accomplished with ls -R. Now type this: find ~/csci3308 -name bin -print This will print only les and directories named bin in your directory structure. This is the purpose of nd: to locate les and directories that match specied characteristics. You can also search for wildcard expressions. Type the following: find ~/csci3308 -name \*.c -print This should print every le that ends with .c. The backslash is used to prevent the shell from interpreting the asterick in the above command line. Another way of writing the same command is: find ~/csci3308 -name *.c -print 1. Write a nd command to print all les under your csci3308 directory whose names are exactly three characters. /10 1 Quoting in the Shell The quotes above are necessary because you want *.c to be interpreted by the nd program, and not the shell. Without the quotes the shell will process the * character and nd will never see it. Find knows how to interpret shell wildcards, but you need to keep the shell from replacing them before nd can see them. There are three types of quotes in tcsh, single quotes, , double quotes, ", and backslash, \. The purpose of quotes is to make the shell ignore characters that it would normally interpret or replace. Single and double quotes must come in matching pairs, and they aect everything between the quotes. Backslash aects only the single character immediately following the backslash. There are some minor dierences between single quotes and double quotes. Finding the right quotes for a particular situation can sometimes be a process of trial and error. Here is a brief summary of the dierences between single quotes and double quotes when using them at the command line. Single quotes protect all metacharacters from interpretation, with the exception of the history character (i.e. !). Metacharacters are characters which have special meaning to the shell like * or \. Double quotes protect all metacharacters from interpretation, with the exception of the history character (!), the variable substitution character ($), and the back quote, which is used for command substitution (see below). For a complete description of quoting-related issues, see the tcsh man page, or a book that covers Unix-related topics. 2. Type the following and record the results for each line next to it below: echo echo echo echo $shell $term $shell $term "$shell $term" \$shell $term 3. Why is the output of the rst and third lines the same? In addition to quoting, there is the backward single quote, , also called back tick or back quote. The back quote invokes command substitution, and its purpose is to cause more substitution, not less. Anything between two back quotes is considered to be a command. This command is executed and its output is placed on the command line where the original command used to be. Try the following: echo date echo date 2 Back to Find -name and -print are just two operators, and nd has many more. Type the following: find ~/csci3308 -perm -004 -print This should nd all les in your csci3308 directory that have read permission for the others category. You can use this command to check what les in your directory are publically accessible to other users. 4. Rewrite the command above to locate those les whose permissions are exactly 004. Use the find man page for help. Look at the nd operators in the nd man page. 5. Write a nd command that prints all les in your ~/csci3308 directory accessed less than 5 days ago. Try this command out to make sure it works. 6. Write a nd command that prints all les in your ~ directory that are of type directory, and whose names contain a numeric character. Find can create more complicated boolean expressions with its operators. The exclamation point for stands not. The following command nds les underneath the current directory whose names do not end in .c. find . ! -name *.c -print Sometimes parentheses must be used for grouping especially when using -a (and), or -o (or). The parentheses must be quoted with either quotes or a backslash so that the shell does not interpret them. find . \( -type f -o -type d \) -a \( -name program* -o -name bin \) -print 3 Find has two operators, -exec and -ok that can be used to run other programs on the les that are found. Try the two commands below: find . find . -type d -name bin -exec echo {} is cool \; -type d -name bin -ok echo {} is cool \; 7. What is the dierence between -exec and -ok? In every -exec or -ok command you can use the two characters {}. When the command is run these characters are replaced with the name of the le being found. If multiple les are found the command is run once for each le, and each time {} is replaced with a new name. Also, any -exec or -ok command must end with a semicolon (;) which must be quoted, in this case with backslash. If the semicolon is missing, the shell will report a syntax error. Grep Grep searches the contents of a le to nd lines that match a pattern. Grep uses regular expression syntax for its pattern matching, which is dierent than shell wildcards. Once again, patterns have to be quoted to keep the shell from trying to evaluate them. In this lab we will be using egrep, expression grep, which is grep with a few extra features. In general, we will use the words grep and egrep interchangeably. In most cases, grep and egrep return the same results...we will try to highlight cases in which their output is dierent. For instance, the two commands below produce dierent output (You can look at the le /usr/dict/words if you want): egrep ^b.*(na)+$ /usr/dict/words grep ^b.*(na)+$ /usr/dict/words 8. What is the output for each command and why is it dierent? Returning to our discussion, grep is dierent from nd in another way. Find only matches a lename if the entire lename matches a pattern. grep will display a line as a match if any part of the line matches an input pattern. Try this: egrep fly /usr/dict/words 4 Grep nds not just the word y, but every word that contains the word y. If you want to match exactly your pattern and nothing more use the beginning and end of line characters, ^ and $. egrep ^fly /usr/dict/words egrep fly$ /usr/dict/words egrep ^fly$ /usr/dict/words Sometimes, you need to keep grep from interpreting special characters too. For example, you may want to nd all lines with matched parenthesis in your .cshrc le. You start by trying this: egrep (.*) ~/.cshrc the shell sees (.*) and it knows not to evaluate special characters in this word. It strips o the quotes and passes (.*) to egrep. However, egrep uses parentheses for grouping. egrep assumes you want to nd the pattern .*, and you put parentheses around it just to be careful. So egrep tries to match the pattern .* which matches anything and prints every line of your le. What you actually wanted was the literal character left parenthesis, (, then anything, .*, and then a literal right parenthesis, ). You need to put backslashes in front of the parentheses to make egrep treat them as literal characters. egrep \(.*\) ~/.cshrc So the single quotes are for the shell, and the backslashes are for egrep. You still need the single quotes or the shell would try to interpret the backslashes and asterisk. Sometimes getting the exact pattern you want can be tricky. Note: this is an instance where grep and egrep return dierent results. grep does not assign special meaning to parentheses so the parentheses do not need to be quoted when using grep. egrep has a more powerful regular expression engine than grep in which parentheses are assigned a special meaning, which we will cover later in the semester. 9. Write an egrep command to search a le named text for lines that contain a backslash. To test this create a sample le named text in your tmp directory with some lines that contain a backslash, and some that dont. 5 Using Grep with Find Grep and nd can be combined to create a powerful search tool. Write a nd command, and then add the -exec operator to run a grep command on the les that it nds. The following command nds all .c les in your directory structure that contain the word help: find ~ -name *.c -exec egrep help {} \; -print 6
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Colorado - CS - 3308
Lab #3 Automating Installation & Introduction to Make Due in Lab, September 15, 2004Name: Lab Time: Grade: Error Checking In this lab you will be writing a shell script to automate the installation of a system. The system that your shell script wil
Colorado - CS - 3308
Todays Lecture Lecture 2: No Silver BulletKenneth M. Anderson Software Methods and Tools CSCI 3308 - Fall Semester, 2004August 27, 2004 University of Colorado, 2004 2Discuss No Silver Bullet paper Brooks reflections on it after nine years
Colorado - CS - 3308
Todays Lecture Lecture 6: Build ManagementKenneth M. Anderson Software Methods and Tools CSCI 3308 - Fall Semester, 2004September 10, 2004 University of Colorado, 2004 2Discuss Build Management Introduce makeBuild ManagementDuring the impleme
Colorado - CS - 3308
Todays Lecture Lecture 7: Make MacrosKenneth M. Anderson Software Methods and Tools CSCI 3308 - Fall Semester, 2004Brief review of make Explore make macros in more detailNote: when you see macro think variableBrooks Corner: The Mythical Man-Mont
Colorado - CULTER - 06
CU Mountain006 Research StationWinter 2 Ecology
Colorado - ASTR - 5770
New InflationAmy Bender 05/03/2006Inflation Basics Perturbations from quantum fluctuations of scalar field Fluctuations are: Gaussian Scale Invariant Spectrum (almost) k3P(k) ~ constant Adiabatic Scalar & Tensor Matter/radiation anisotrop
Colorado - ASTR - 5770
HST Key Project on the Extragalactic Distance ScalePresentation by Alaine Ginocchio May 5, 2006HST Key ProjectMeasuring an accurate value of H0 was one of the motivating reasons for building NASA/ESA Hubble Space Telescope (HST).Measurement
Colorado - ASTR - 5770
Holographic Dark EnergyPreety Sidhu 5 May 2006Black Holes and Entropy Black holes are maximal entropy objects Entropy of a black hole proportional to surface area of event horizon Max entropy for volume of space goes as bounding surface area, n
Colorado - ASTR - 5770
The Sunyaev-Zeldovich EffectJason Glenn APSHistorical Perspective Physics of the SZ Effect -Previous Observations & Results Bolocam Imminent Experiments Future Work ReferencesCMB discovered in 1964 by Penzias and Wilson COBE 1989: perfect blackbo
Wisconsin - CS - 0601
Proximal Plane ClassificationKDD 2001 San Francisco August 26-29, 2001Glenn Fung & Olvi MangasarianData Mining InstituteUniversity of Wisconsin - Madison Second Annual Review June 1, 2001Key ContributionsFast new support vector machine class
Wisconsin - REV - 0601
Proximal Plane ClassificationKDD 2001 San Francisco August 26-29, 2001Glenn Fung & Olvi MangasarianData Mining InstituteUniversity of Wisconsin - Madison Second Annual Review June 1, 2001Key ContributionsFast new support vector machine class
St. Johns River Community College - CS - 0601
Proximal Plane ClassificationKDD 2001 San Francisco August 26-29, 2001Glenn Fung & Olvi MangasarianData Mining InstituteUniversity of Wisconsin - Madison Second Annual Review June 1, 2001Key ContributionsFast new support vector machine class
Wisconsin - CS - 0600
Concave Minimization for Support Vector Machine ClassifiersUnlabeled Data Classification & Data SelectionGlenn Fung O. L. MangasarianPart 1: Unlabeled Data Classifications ssssGiven a large unlabeled dataset Use a k-Median clustering al
Wisconsin - REV - 0600
Concave Minimization for Support Vector Machine ClassifiersUnlabeled Data Classification & Data SelectionGlenn Fung O. L. MangasarianPart 1: Unlabeled Data Classifications ssssGiven a large unlabeled dataset Use a k-Median clustering al
St. Johns River Community College - CS - 0600
Concave Minimization for Support Vector Machine ClassifiersUnlabeled Data Classification & Data SelectionGlenn Fung O. L. MangasarianPart 1: Unlabeled Data Classifications ssssGiven a large unlabeled dataset Use a k-Median clustering al
Wisconsin - ECE - 756
Linear Programming and CPLEXTing-Yuan Wang Advisor: Charlie C. ChenDepartment of Electrical and Computer Engineering University of Wisconsin-MadisonFeb. 22 2000CPLEX Optimization Options: Primal, Dual Simplex Methods Network Flow Problems MI
St. Johns River Community College - ECE - 756
Linear Programming and CPLEXTing-Yuan Wang Advisor: Charlie C. ChenDepartment of Electrical and Computer Engineering University of Wisconsin-MadisonFeb. 22 2000CPLEX Optimization Options: Primal, Dual Simplex Methods Network Flow Problems MI
Wisconsin - ECE - 03
Artifact and Textured region Detection- Vishal BangardOutline Need for artifact and textured region detection Aim of the project Techniques used in the imaging world Approaches used Results ConclusionWhy do artifact detection ? A lot of
Wisconsin - ECE - 738
Artifact and Textured region Detection- Vishal BangardOutline Need for artifact and textured region detection Aim of the project Techniques used in the imaging world Approaches used Results ConclusionWhy do artifact detection ? A lot of
St. Johns River Community College - ECE - 03
Artifact and Textured region Detection- Vishal BangardOutline Need for artifact and textured region detection Aim of the project Techniques used in the imaging world Approaches used Results ConclusionWhy do artifact detection ? A lot of
St. Johns River Community College - ECE - 738
Artifact and Textured region Detection- Vishal BangardOutline Need for artifact and textured region detection Aim of the project Techniques used in the imaging world Approaches used Results ConclusionWhy do artifact detection ? A lot of
Wisconsin - ECE - 03
Unequal Error Protection for Video Transmission over Wireless ChannelsECE738 Project PresentationChang, Hong Hong 05/09/20031OutlineUnequal Error Protection/ Unequal Loss Protection Problem Formulation Channel Model RS code Theoretical Res
Wisconsin - ECE - 738
Unequal Error Protection for Video Transmission over Wireless ChannelsECE738 Project PresentationChang, Hong Hong 05/09/20031OutlineUnequal Error Protection/ Unequal Loss Protection Problem Formulation Channel Model RS code Theoretical Res
St. Johns River Community College - ECE - 03
Unequal Error Protection for Video Transmission over Wireless ChannelsECE738 Project PresentationChang, Hong Hong 05/09/20031OutlineUnequal Error Protection/ Unequal Loss Protection Problem Formulation Channel Model RS code Theoretical Res
St. Johns River Community College - ECE - 738
Unequal Error Protection for Video Transmission over Wireless ChannelsECE738 Project PresentationChang, Hong Hong 05/09/20031OutlineUnequal Error Protection/ Unequal Loss Protection Problem Formulation Channel Model RS code Theoretical Res
Wisconsin - ECE - 03
Portraiture MorphingPresented by Fung, Chau-ha JeniceOutline Problem Statement Prior Art: Portraiture Morphing Approaches Results Conclusion Future WorksProblem Statement Image morphing = Image metamorhposis Creating a smooth transfor
Wisconsin - ECE - 738
Portraiture MorphingPresented by Fung, Chau-ha JeniceOutline Problem Statement Prior Art: Portraiture Morphing Approaches Results Conclusion Future WorksProblem Statement Image morphing = Image metamorhposis Creating a smooth transfor
St. Johns River Community College - ECE - 03
Portraiture MorphingPresented by Fung, Chau-ha JeniceOutline Problem Statement Prior Art: Portraiture Morphing Approaches Results Conclusion Future WorksProblem Statement Image morphing = Image metamorhposis Creating a smooth transfor
St. Johns River Community College - ECE - 738
Portraiture MorphingPresented by Fung, Chau-ha JeniceOutline Problem Statement Prior Art: Portraiture Morphing Approaches Results Conclusion Future WorksProblem Statement Image morphing = Image metamorhposis Creating a smooth transfor
Wisconsin - ECE - 03
ECE 738 ProjectBrain segmentation and Phase unwrapping in MRI dataJongHoon LeeOutline Nature of fast MRI: EPI & Field Inhomogeneity Background problem Image Distortion Specific problems a) Brain Segmentation b) Phase Unwrapping Goal Appro
Wisconsin - ECE - 738
ECE 738 ProjectBrain segmentation and Phase unwrapping in MRI dataJongHoon LeeOutline Nature of fast MRI: EPI & Field Inhomogeneity Background problem Image Distortion Specific problems a) Brain Segmentation b) Phase Unwrapping Goal Appro
St. Johns River Community College - ECE - 03
ECE 738 ProjectBrain segmentation and Phase unwrapping in MRI dataJongHoon LeeOutline Nature of fast MRI: EPI & Field Inhomogeneity Background problem Image Distortion Specific problems a) Brain Segmentation b) Phase Unwrapping Goal Appro
St. Johns River Community College - ECE - 738
ECE 738 ProjectBrain segmentation and Phase unwrapping in MRI dataJongHoon LeeOutline Nature of fast MRI: EPI & Field Inhomogeneity Background problem Image Distortion Specific problems a) Brain Segmentation b) Phase Unwrapping Goal Appro
Wisconsin - ECE - 03
ECE738 Presentation of Project SurveyA survey of image-based biometric identification methods: Face, finger print, iris, and othersPresented by: David LinOutline Problems and motivations Different identification methods Face Recognition Fing
Wisconsin - ECE - 738
ECE738 Presentation of Project SurveyA survey of image-based biometric identification methods: Face, finger print, iris, and othersPresented by: David LinOutline Problems and motivations Different identification methods Face Recognition Fing
St. Johns River Community College - ECE - 03
ECE738 Presentation of Project SurveyA survey of image-based biometric identification methods: Face, finger print, iris, and othersPresented by: David LinOutline Problems and motivations Different identification methods Face Recognition Fing
St. Johns River Community College - ECE - 738
ECE738 Presentation of Project SurveyA survey of image-based biometric identification methods: Face, finger print, iris, and othersPresented by: David LinOutline Problems and motivations Different identification methods Face Recognition Fing
Wisconsin - ECE - 03
A survey of Face Recognition TechnologyWei-Yang Lin May 07, 2003Road Map Introduction Challenge in Face Recognition variation in pose Variation in illumination Some recently works in FRT DiscussionIntroduction FRT is a research area span
Wisconsin - ECE - 738
A survey of Face Recognition TechnologyWei-Yang Lin May 07, 2003Road Map Introduction Challenge in Face Recognition variation in pose Variation in illumination Some recently works in FRT DiscussionIntroduction FRT is a research area span
St. Johns River Community College - ECE - 03
A survey of Face Recognition TechnologyWei-Yang Lin May 07, 2003Road Map Introduction Challenge in Face Recognition variation in pose Variation in illumination Some recently works in FRT DiscussionIntroduction FRT is a research area span
St. Johns River Community College - ECE - 738
A survey of Face Recognition TechnologyWei-Yang Lin May 07, 2003Road Map Introduction Challenge in Face Recognition variation in pose Variation in illumination Some recently works in FRT DiscussionIntroduction FRT is a research area span
Wisconsin - ECE - 03
Medical Image Registration: A SurveyAiming LuOutline Introduction Transformation Algorithms Visualization Validation ConclusionIntroduction Image registration matching two images so that corresponding coordinate points in the two images
Wisconsin - ECE - 738
Medical Image Registration: A SurveyAiming LuOutline Introduction Transformation Algorithms Visualization Validation ConclusionIntroduction Image registration matching two images so that corresponding coordinate points in the two images
St. Johns River Community College - ECE - 03
Medical Image Registration: A SurveyAiming LuOutline Introduction Transformation Algorithms Visualization Validation ConclusionIntroduction Image registration matching two images so that corresponding coordinate points in the two images
St. Johns River Community College - ECE - 738
Medical Image Registration: A SurveyAiming LuOutline Introduction Transformation Algorithms Visualization Validation ConclusionIntroduction Image registration matching two images so that corresponding coordinate points in the two images
Wisconsin - ECE - 03
Detecting Artifacts and Textures in Wavelet Coded ImagesRajas A. Sambhare ECE 738, Spring 2003 Final ProjectJanuary 12, 2009Motivation Wavelet based image coders like JPEG 2000 lead to new types of artifacts when used at small bit-rates Bloc
Wisconsin - ECE - 738
Detecting Artifacts and Textures in Wavelet Coded ImagesRajas A. Sambhare ECE 738, Spring 2003 Final ProjectJanuary 12, 2009Motivation Wavelet based image coders like JPEG 2000 lead to new types of artifacts when used at small bit-rates Bloc
St. Johns River Community College - ECE - 03
Detecting Artifacts and Textures in Wavelet Coded ImagesRajas A. Sambhare ECE 738, Spring 2003 Final ProjectJanuary 12, 2009Motivation Wavelet based image coders like JPEG 2000 lead to new types of artifacts when used at small bit-rates Bloc
St. Johns River Community College - ECE - 738
Detecting Artifacts and Textures in Wavelet Coded ImagesRajas A. Sambhare ECE 738, Spring 2003 Final ProjectJanuary 12, 2009Motivation Wavelet based image coders like JPEG 2000 lead to new types of artifacts when used at small bit-rates Bloc
Wisconsin - ECE - 03
MPEG2 FGS ImplementationECE 738 Advanced Digital Image ProcessingAuthor: Deshan Yang05/01/2003Introduction of FGSFGS = fine granularity scalability For MPEG2 / MPEG4 and others Comparing to SNR, temporal, spatial scalability, FGS enhances vi
Wisconsin - ECE - 738
MPEG2 FGS ImplementationECE 738 Advanced Digital Image ProcessingAuthor: Deshan Yang05/01/2003Introduction of FGSFGS = fine granularity scalability For MPEG2 / MPEG4 and others Comparing to SNR, temporal, spatial scalability, FGS enhances vi
St. Johns River Community College - ECE - 03
MPEG2 FGS ImplementationECE 738 Advanced Digital Image ProcessingAuthor: Deshan Yang05/01/2003Introduction of FGSFGS = fine granularity scalability For MPEG2 / MPEG4 and others Comparing to SNR, temporal, spatial scalability, FGS enhances vi
St. Johns River Community College - ECE - 738
MPEG2 FGS ImplementationECE 738 Advanced Digital Image ProcessingAuthor: Deshan Yang05/01/2003Introduction of FGSFGS = fine granularity scalability For MPEG2 / MPEG4 and others Comparing to SNR, temporal, spatial scalability, FGS enhances vi
Wisconsin - ECE - 539
Using Clustering to Make Prediction Intervals For Neural NetworksClaus Benjaminsen ECE539 - final project fall 2005What is a prediction interval? Aninterval within which the true target value is predicted to be Prediction intervals are often
St. Johns River Community College - ECE - 539
Using Clustering to Make Prediction Intervals For Neural NetworksClaus Benjaminsen ECE539 - final project fall 2005What is a prediction interval? Aninterval within which the true target value is predicted to be Prediction intervals are often
Wisconsin - ECE - 539
Music ClassificationUsing Neural Networks Craig Dennis ECE 539Problem and Motivation Peoplehave hundreds of MP3s and other digital music files unclassified on their computer iTunes and other large digital music stores must classify thousands o
St. Johns River Community College - ECE - 539
Music ClassificationUsing Neural Networks Craig Dennis ECE 539Problem and Motivation Peoplehave hundreds of MP3s and other digital music files unclassified on their computer iTunes and other large digital music stores must classify thousands o
Wisconsin - ECE - 539
Determining College Football RankingsWith ClusteringWhere do we start? Look for statistics on the web This keeps data up to date smoother updates. Determine good statistic set Dont want too many so that data is redundant Dont want too few
St. Johns River Community College - ECE - 539
Determining College Football RankingsWith ClusteringWhere do we start? Look for statistics on the web This keeps data up to date smoother updates. Determine good statistic set Dont want too many so that data is redundant Dont want too few
Wisconsin - ECE - 539
Predicting the Winner of an NFL Football GameMatt Gray CS/ECE 539Reasons to Predict NFL Football is watched by millions of people every weekend during the season. Vast amounts of money invested in NFL Football Prediction Polls such as Weekly Fo
St. Johns River Community College - ECE - 539
Predicting the Winner of an NFL Football GameMatt Gray CS/ECE 539Reasons to Predict NFL Football is watched by millions of people every weekend during the season. Vast amounts of money invested in NFL Football Prediction Polls such as Weekly Fo