0% found this document useful (0 votes)
27 views

NAA Lab Version1

Uploaded by

isthiakar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

NAA Lab Version1

Uploaded by

isthiakar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Final term NAA-Lab version1

(section NAA)

Max Marks-12 Time Duration: 70 minutes


Note: Take a snapshot of each command within the tasks and its output for
verification and make a word file to submit on the portal
Task1-Regular expression using sed, awk and grep: (2 marks)
Using the given file ‘books.txt’, perform the following tasks:

i. Use grep to print all books information where author is "Jane Austen".
ii. Use sed to extract all lines containing IP addresses (string of the form
10.10.10.211) from the text file and delete it
iii. Use sed to delete all lines containing the word "Mockingbird".
iv. Use awk to print the first and third columns of the text file, separated by a
space.

Task2- C version control: (3 marks)


1. Create a repository cvs/project/apps in your home directory
2. Create a file hello.c inside apps directory with the following content
3. Return to your home directory and
4. Set the CVSROOT VARIABLE for this repository
/home/<studentname>/cvs/project and start the repository.
5. Checkout the apps module from the repository. Modify the file
apps/calculate.c by adding one more line printf(“Good Day”)
6. Save changes to the file and follow all the steps to commit the updated
file to the cvs repository.
Task3- C code debugging using gdb (3 marks)
 Create a c file original.c with the following code:


Perform the following instructions using gdb:
1. Set Breakpoint at line4
2. Run the Program
3. Print Variable Values of variables: num1, num2 and result
5. List the source code around the current execution point
6. Set Breakpoint at line 6
7. Continue Execution until the next breakpoint
8. print variable value of result
9. Exit the program, fix the bug for variable num2, compile and rerun the code.
(Take snapshots of all steps).

Task4- Shell scripting: (2 marks)


Write a script that create three empty files with names a.png, b.png,c.png
in your home directory and further performs the following tasks:
 Using for loop, script iterates through all the .png files in the current
directory and asks the user if he or she wants to remove it. If answer is Y
or y, the code deletes that file.
 Before exiting the code the script displays remaining files in the current
directory.
Task5- Shell scripting: (2 marks)

Write a shell script to display following menu of commands to the user, take
user input and perform the user specified task from the menu:
1. Printing cars with their prices (define cars as an array)
2. Print the hostname
3. Display long listing of current directory in reverse order
Based on user input the script performs the command and exits. (Use case
construct)

You might also like