PROGRAM NO : 1
Inventory file sorting
#!/bin/bash
clear
echo "enter the file
name"
read fname
if [ -e $fname ]
then
cat $fname
echo "enter the field number
for perform sorting"
read fld
echo "enter the name of the
newfile to which output is sorted"
read newfname
sort -k $fld $fname>$newfname
cat $newfname
else
echo "file not found"
fi
PROGRAM NO : 2
Files containing same Pattern in a directory
#!/bin/bash
clear
echo "Enter the Directory
name"
read dirname
if [ -d $dirname ]
then
echo "Enter the pattern to be
searched"
read pat
grep $pat $dirname/*
else
echo "No such Directory"
fi
PROGRAM NO : 3
Process communication
#include<stdio.h>
main()
{
char s[22];
int
pid,p1[2];
pipe(p1);
pid=fork();
if(pid==0)
{
read(p1[0],s,sizeof(s));
printf("\n
child process with process id %d\n",pid);
printf("mesage
read by child: %s\n",s);
printf("Bye
from child\n");
}
else
{
printf("\n
Parent Process with processid %d\n",pid);
printf("enter
the message to print\n");
scanf("%[^\n]",s);
write(p1[1],s,sizeof(s));
printf("Bye
from parent\n");
}
close(p1[1]);
close(p1[0]);