X hits on this document





36 / 93

Page 36 of 93

b)Write a sed command that deletes the character before the last character in each line in a file.

c)Write a sed command that swaps the first and second words in each line in a file.


a)Pipe your /etc/passwd file to awk, and print out the home directory of each user.

b)Develop an interactive grep script that asks for a word and a file name and then tells how many lines contain that word.


d)Part using awk


a)Write a shell script that takes a command –line argument and reports on whether it is directory, a file, or something else.

b)Write a shell script that accepts one or more file name as arguments and converts all of them to uppercase, provided they exist in the current directory.

c)Write a shell script that determines the period for which a specified user is working on the system.


a)Write a shell script that accepts a file name starting and ending line numbers as arguments and displays all the lines between the given line numbers.

b)Write a shell script that deletes all lines containing a specified word in one or more files supplied as arguments to it.


a)Write a shell script that computes the gross salary of a employee according to the following rules:

i)If basic salary is < 1500 then HRA =10% of the basic and DA =90% of the basic.

ii)If basic salary is >=1500 then HRA =Rs500 and DA=98% of the basic

The basic salary is entered interactively through the key board.

b)Write a shell script that accepts two integers as its arguments and computers the value of first number raised to the power of the second number.


a)Write an interactive file-handling shell program. Let it offer the user the choice of copying, removing, renaming, or linking files. Once the user has made a choice, have the program ask the user for the necessary information, such as the file name, new name and so on.

b)Write  shell script that takes a login name as command – line argument and reports when that person logs in

c)Write a shell script which receives two file names as arguments. It should check whether the two file contents are same or not. If they are same then second file should be deleted.


a)Write a shell script that displays a list of all the files in the current directory to which the user has read, write and execute permissions.

b)Develop an interactive script that ask for a word and a file name and then tells how many times that word occurred in the file.

c)Write a shell script to perform the following string operations:

i)To extract a sub-string from a given string.

ii)To find the length of a given string.


Write a C program that takes one or more file or directory names as command line input and reports the following information on the file:

i)File type

ii)Number of links

iii)Read, write and execute permissions

iv)Time of last access

(Note : Use stat/fstat system calls)

Document info
Document views115
Page views115
Page last viewedSun Oct 23 08:22:40 UTC 2016