0% found this document useful (0 votes)
28 views9 pages

Unix179 Vasu

This document outlines 18 programming assignments for a UNIX and Shell Programming course. The assignments include tasks such as using grep, sed, and awk commands to modify text files, writing shell scripts to check for palindromes, reverse strings, find the largest file, and calculate the second highest number from a list. It also includes tasks to display specific lines from a file, remove a directory tree, move files between directories, convert between number bases, and write a menu-driven script to count characters in a file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views9 pages

Unix179 Vasu

This document outlines 18 programming assignments for a UNIX and Shell Programming course. The assignments include tasks such as using grep, sed, and awk commands to modify text files, writing shell scripts to check for palindromes, reverse strings, find the largest file, and calculate the second highest number from a list. It also includes tasks to display specific lines from a file, remove a directory tree, move files between directories, convert between number bases, and write a menu-driven script to count characters in a file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

UNIX & SHELL PROGRAMMING

Name: PAVASIYA VASU RASIKBHAI (TYBCA-179) Seat No.:

Subject: PRACTICAL ASSIGNMENT

506: UNIX & SHELL PROGRAMMING

Index
Sr. Description Page no Date Sign
No.
1 Write a command using grep or sed or awk to replace

2
all occurrences of 'she' with 'he' and 'hi' with 'hello'.
2 Write a command using grep or sed or awk to locate 2
lines that begin and end with. (dot)
3 Write a command using grep or sed or awk to display 2
lines 5 to 15, 25 to 35 and the last line of file f1.
4 Write a command to count the number of characters 3
in the first five lines of file x1.
5 Write a shell script to check whether the given string 3
is palindrome or not.
6 Write a shell script to accept a string and reverse it 4
without using rev () function, apply proper validation
7 Write a shell script to find a file with maximum size in 4
the current directory, also print the no of words,
characters, and lines along with the content of file.
8 Write awk command to print odd number of words in 5
each line.
9 Write a command using grep or sed or awk to display 6
all lines that contains 'ab*' in a line.
10 Write a command using grep or sed or awk to locate 6
lines where first and last characters of file fl are same.
11 Write a command using grep or sed or awk to replace 6
'hello' with 'Good Morning' in input file 'al.sh' and write
those lines to output file a2.sh.
12 Write a shell program that accept five numbers and 7
display second highest number from the entered
numbers.
13 Write a shell script which can be utilized as a 7
calculator. The values can be entered using
command line arguments
14 To display line 15 to 25 from file f1. 8
15 To remove directory tree fold1/fold2/fold3 using single 8
command.
16 To move all the files that begins with the digit from the 8
parent directory to current directory.
17 To convert decimal 192 to hexadecimal 8

18 Write a script to perform following operations using 20 9


menu :
* Count alphabets
* Count special characters from the file

VASU_179 1
UNIX & SHELL PROGRAMMING

(1) Write a command using grep or sed or awk to replace all


occurrences of 'she' with 'he' and 'hi' with 'hello'.

(2) Write a command using grep or sed or awk to locate lines that begin
and end with. (dot)

(3) Write a command using grep or sed or awk to display lines 5 to 15,
25 to 35 and the last line of file f1.

VASU_179 2
UNIX & SHELL PROGRAMMING

(4) Write a command to count the number of characters in the first five
lines of file x1.

(5) Write a shell script to check whether the given string is palindrome or
not.

VASU_179 3
UNIX & SHELL PROGRAMMING

(6) Write a shell script to accept a string and reverse it without using rev
() function, apply proper validation.

(7) Write a shell script to find a file with maximum size in the current
directory, also print the no of words, characters, and lines along with the
content of file.

VASU_179 4
UNIX & SHELL PROGRAMMING

(8) Write awk command to print odd number of words in each line

VASU_179 5
UNIX & SHELL PROGRAMMING

(9) Write a command using grep or sed or awk to display all lines that
contains 'ab*' in a line.

(10) Write a command using grep or sed or awk to locate lines where
first and last characters of file fl are same.

(11) Write a command using grep or sed or awk to replace 'hello' with
'Good Morning' in input file 'al.sh' and write those lines to output file
a2.sh

VASU_179 6
UNIX & SHELL PROGRAMMING

(12) Write a shell program that accept five numbers and display second
highest number from the entered numbers.

(13) Write a shell script which can be utilized as a calculator. The values
can be entered using command line arguments.

VASU_179 7
UNIX & SHELL PROGRAMMING

(14) To display line 15 to 25 from file f1.

(15) To remove directory tree fold1/fold2/fold3 using single command

(16) To move all the files that begins with the digit from the parent
directory to current directory.

(17) To convert decimal 192 to hexadecimal.

VASU_179 8
UNIX & SHELL PROGRAMMING

(18) Write a script to perform following operations using 20 menu : *


Count alphabets * Count special characters from the file

VASU_179 9

You might also like