Вы находитесь на странице: 1из 2

SSN College of Engineering, Kalavakkam Department of Computer Science and Engineering Computer Practice Laboratory II

Exercise 4 : Working of Comparison & Searching Commands


A .Work out the following redirection operators > - Output redirection Operator usage : command > filename eg. cat > filename < - Input redirection Operator usage : command < filename eg. cat < filename >> - Append content usage : command >> filename eg. cat >> filename or cat f1 >> f2 1. Display all the input that are typed in the console immediately using cat command 2. Create a file "College" and "Country" using output direction operator 3. Write the output of ls in a file and count the number of lines in that file 4. Concatenate College and country files information into a single file called "colleges_and_country" 5. Append some more college information in college file and Display the contents of college file using input direction operator B. Work out the following Pipe Command ( | ) | - pipe command usage : command 1 | command2 eg. ls | more ls command-list directory more command- list page by page Output of Command1 is given as Input to Command2 1. Count the number of lines available in listing your directory 2. Count the number of users logged in 3. Show the name of users who were logged in 4. Show the name and time of login users 5. Create a file named "big_file" which contains more than 50 lines. Show the difference between the commands "cat big_file" and "cat big_file | more" C. Work out the following Comparison & Searching Commands diff - -i, -b, -B, -q cmp - - l, -n grep -b -c -v ------ -n, -v, -c , -A, -B, -f, -i 1. Create Three files file1, file2, file3 as needed for each command 2. Show that the given two files are differed by giving the message " Files are differ" 3. Show that the given two files are same in case insensitive manner 4. Compare the given two files and show they are differ or not 5. What is the difference between diff and cmp command

6. Compare and show that the first 5 bytes of two given files are same. But the whole file is different 7. Compare and show how each byte in the given two files differ among themselves 8. Search whether the given pattern is available in file1 and file3 9. Search the file for the given pattern and print its count 10. Search the file and print the non pattern matching lines 11. Search the file and count the number of non pattern matching lines 12. Search the given pattern in the file by case insensitive manner 13. Create a file which contains the patterns to be searched. Search the pattern file with file1 14. What is the expansion for grep 15. What do you mean by regular expression

Вам также может понравиться