Shell script that accepts a filename, starting and ending line numbers as arguments and displays all the lines between the given line numbers

Concept:Cat: cat command is used to create the fileSyntax: cat > file name for creationSyntax: cat file name for displaying a fileSed: sed means stream editor it can be used for editing…

Continue ReadingShell script that accepts a filename, starting and ending line numbers as arguments and displays all the lines between the given line numbers

C program that creates a child process to read commands from the standard input

#include #include #include int main() { int pid,status; char comd[20];pid=fork(); if(pid==0) { printf("child processn"); while(strcmp(comd,"exit")!=0) { printf("[user@localhost~]$"); gets(comd); system(comd); } exit(0); } else { wait(&status); printf("parent processn"); } } ****************************************…

Continue ReadingC program that creates a child process to read commands from the standard input

Shell script that performs following string handling operations i) Calculate the length of the string ii) locate a position of a character in a string iii) extract last three characters from string

#!/bin/sh str=tanu echo “string:$str” echo “lengh of string:” z=`expr “$str”:’.*’` echo $z echo “substring is” z=`expr “$str”:’.*(…)’` echo $z echo “position of character n is” z=`expr “$str”:’[^n]*n’` echo $z *******************…

Continue ReadingShell script that performs following string handling operations i) Calculate the length of the string ii) locate a position of a character in a string iii) extract last three characters from string