=====unix Keywords===== ====The UNIX Programming Environment: Assembler==== ===Definition=== An assembler is a program used for converting instructions written in low-level code into machine level code. ===Demonstration=== Demonstration of the chosen keyword. lab46:~$ touch file.asm lab46:~$ nasm -f bin file.asm -o file.o lab46:~$ ls file.asm file.o lab46:~$ ====The UNIX Programming Environment: Linker==== ===Definition=== A linker is a program used with a compiler or assembler to provide links to the libraries needed for an executable program. ===Demonstration=== Demonstration of the chosen keyword. lab46:~$ ld -o fileA hello.o lab46:~$ ls lab46:~$ fileA hello.o ====Filtering==== ===Definition=== A piece of software that processes text, for example to remove unwanted spaces or to format it for use in another application. ===Demonstration=== Demonstration of the chosen keyword. lab46:~$ touch apple.txt lab46:~$ vi apple.txt core worm seed jewel lab46:~$ cat apple.txt core worm seed jewel lab46:~$ cat apple.txt | sed -e "s/e/WWW/" corWWW worm sWWWed jWWWwel lab46:~$ cat apple.txt | sed -e "s/e/J/g" corJ worm sJJd jJwJl ====The UNIX Programming Environment: Source Code==== ===Definition=== A source code is a text listing of commands to be compiled or assembled into an executable computer program. ===Demonstration=== Demonstration of the chosen keyword. lab46:~$ cat helloC.c /* * helloC.c - a simple "Hello, World!" in C. * * To compile: gcc -o helloC helloC.c */ // include standard I/O functions // #include // main() function // int main() { puts("Hello, World!\n"); return(0); } lab46:~$ ====Pattern Matching==== ===Definition=== Act of checking some sequence of tokens for the presence of the constituents of some pattern ===Demonstration=== . Match any character * Match 0 or more of the preceding ^ Beginning of line or string $ End of line or string [ ] Character class - match any of the enclosed characters [^ ] Negated character class - do not match any of the enclosed characters \< Beginning of word \> End of word lab46:~$ grep ^[b-d][aeiou] /etc/passwd daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh backup:x:34:34:backup:/var/backups:/bin/sh lab46:~$ ====Security==== ===Definition=== Procedures followed or measures taken to ensure safety ===Demonstration=== lab46:~$ id tedmist1 (username) uid=5763(tedmist1) gid=5000(lab46) groups=1730(unix),5763(tedmist1),5000(lab46) ====The UNIX Programming Environment: Library==== ===Definition=== A library is a collection of subroutines or classes used to develop software. ===Demonstration=== **ar(1)** - Maintain portable archive or library. lab46:~$ ar cq lib.a *.o lab46:~$ ls lib.a ===Syntax=== **ar** [arguments] [ posname ] archive file. - Arguments can be found in the man pages of ar. Use man ar. >> **Some arguments include:** >> - c: create a new library >> - q: add the named file to the end of the archive >> - r: replace a named archive/library member >> - t: print a table of archive contents ====Regular Expressions==== ===Definition=== Regular expressions, also referred to as regex or regexp, are search criteria for text pattern matching that provide more flexibility than simple wild-card characters. ===Demonstration=== **These Regular Expressions are as follows:** - . Match any character - * Match 0 or more of the preceding - ^ Beginning of line or string - $ End of line or string - [ ] Character class - match any of the enclosed characters - [^ ] Negated character class - do not match any of the enclosed characters - \< Beginning of word - \> End of word lab46:~$ grep ^[b-d][aeiou] /etc/passwd daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh backup:x:34:34:backup:/var/backups:/bin/sh lab46:~$ =====unix Objective===== ====Understanding And Use Of Pattern Matching==== ===Definition=== Pattern matching is making use of a pattern, usually a regular expression, and trying the pattern various ways on a string to see whether there's any way to make it fit. ===Method=== The method of measurement will be the understand and how to successfully incorporate pattern matching expressions, such as the ones below. ===Measurement=== Follow your method and obtain a measurement. Document the results here. . Match any character * Match 0 or more of the preceding ^ Beginning of line or string $ End of line or string [ ] Character class - match any of the enclosed characters [^ ] Negated character class - do not match any of the enclosed characters \< Beginning of word \> End of word >> By understanding and incorporating these expressions, you can successfully search through a file with ease to get a desired result. ===Analysis=== Reflect upon your results of the measurement to ascertain your achievement of the particular course objective. * How did you do? >> Work in progress, as of right now, I am still learning how to use these. * Is there room for improvement? >> Yes. * Could the measurement process be enhanced to be more effective? >> In time, and the usage of these will making the learning of pattern matching that much easier. * Do you think this enhancement would be efficient to employ? >> Yes it would be efficient to employ when searching through a file for a desired result. * Could the course objective be altered to be more applicable? How would you alter it? >> No the course object is applicable to a student, such as I, situation involved Unix.