Professional Documents
Culture Documents
ulp 5 to 10
ulp 5 to 10
PRACTICAL :- 5
q command :-
p command :-
-n command :-
$!p command :-
2321004
-e in sed:-
Editing text :-Apart from selecting lines sed can also edit text itself like vi editor sed
use.
PRACTICAL :- 6
Aim:- To familiarize with the awk programming.
Theory:- Awk was developed in 1977. Awk is a scripting language used for
manipulating data and generating reports. The awk command programming
language requires no compiling and allows the user to use variables, numeric
functions, string functions, and logical operators.
Syntax :-$awk option ‘pattern{action}’filename
File to perform operations-
10. To print lines if satisfy any one of the conditions using ||(or operator)
System variables
NR :-Number of records
2321004
PRACTICAL :- 7
Aim:- Write a program in perl for scalar variables.
Theory:-A scalar is a single unit of data. That data might be an integer number,
floating point, a character, a string, a paragraph, or an entire web page. Simply saying
it could be anything, but only a single thing.
Program : -
Output : -
2321004
PRACTICAL:- 8
Aim:- Write a program in perl for array variables.
Theory:-A array is special type of variable .The array is used to store the list of value
and each object of list is termed as an element. Element can either be a number, string
or any type of scalar data.
Program : -
Output : -
2321004
PRACTICAL :- 9
Aim:- Write a program in perl for adding and removing elements from array.
Theory:-
1. push @ARRAY, LIST :-Pushes the values of the list onto the end of the array.
2. pop @ARRAY :-Pops off and returns the last value of the array.
3. shift @ARRAY :-Shifts the first value of the array off and returns it, shortening the array
by 1 and moving everything down.
4. unshift @ARRAY, LIST :-Prepends list to the front of the array, and returns the number
of elements in the new array.
Program : -
Output : -
2321004
PRACTICAL :- 10
Aim:- Write a program in perl for hashes variables.
Theory:-A hash is a set of key/value pairs. Hash variables are preceded by a percent
(%) sign. To refer to a single element of a hash, you will use the hash variable name
preceded by a "$" sign and followed by the "key" associated with the value in curly
brackets.
Program : -
Output : -