An open API service indexing awesome lists of open source software.

https://github.com/tirth063/mydoc


https://github.com/tirth063/mydoc

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

# mydoc

Sub : Unix

UNIX Commands

===========================================================================================
2010(March/April)
===========================================================================================
01.To display contents of top 6 largest files in a working directory.
=>ls -l|cut -c 24-28,42-50|sort -rn|head -6

02.To count number of word in line 40 through 60 of file f1.txt.
=> sed -n 40,60p x1|wc �w

03.Match all filenames not beginning with a dot(.).
=>ls -a|grep "[^\.]"

04.Trancefor recursively the ownership of all files in current directory 'bca5'.
=>chown bca5

05.Copies all 6 character file in working directory to dir exit .
=>cp ?????? hak

06.To move all files of working directory modified the last 24 hour to mydir directory under your parent directory.
=>

07.To display all processos run by user1 on terminal pts
=> ps -u user1

08.To display all files of current directory whose 1th character is not digit.
=> ls | grep '^[!0-9].*'

09.To delete all special characters from the file x1.
=> tr -cd "[0-9a-zA-Z]*" ls �i

===========================================================================================
2010(October/November)
===========================================================================================
01.To delete every ; at end of file.
=> grep -v ";$" f1

02.To display all lines, not containing 'printf' in file f1.
=> grep - v "printf" f1

03.To print first three columns and first two rows of file f1.
=> head -2 sed "s/echo/printf/g" testecho

05.To print line number to all lines begins with 'T' in file f1.
=> grep -n "^T" f1

06.To delete all lines begins with 'T' in file f1.
=> grep -v "^T" f1

07.To delete all lines but not the last line of file f1.
=> tail -1 f1

08.To extract first word of each line of file f1.
=> cut -d " " -f 1 test3

09.To replace 'the' with 'he' and 'bad' with 'good' in file f1.
=> sed -e "s/the/he/g" -e "s/bad/good/g" emp1

10.To dissplay all lines that contains pattern g* in a line.
=> grep "g\*" f1

===========================================================================================
2011(March-April)
===========================================================================================
01.To display total number of words and lines of words and lines of files for which file name start with 'm'.
=>wc -l -w m*

02.To remove all leading space from file f1.
=>tr -s " " < f1

03.To display line number before each line.
=>cat -n f1

04.To display line 10 to 20 from file f1.
=>sed -n '10,20p' f1

05.To remove directory tree dir1/dir2/dir3 using single command.
=>rmdir dir1/dir2/dir3 dir1/dir2 dir1

06.To move all files begin with digit from parent directory to current directory.
=>mv.. /[0-9]*/

07.To convert decimal number 192 to hexadecimal.
=>echo "obase=16;192" | bc

08.To give read and write permission to f1.
=>chmod 420 f1

09.To change modification time of file f1 to Dec 01 10:30 am.
=>touch -m | ls -l

10.To display unique word of file f1.
=>sed -n 's//\n/g' f1| sort|uniq -u

11.To display all lines that contains pattern bc* in a line.
=>grep 'bc\*' f1

12.To locate line whose second and second last character of file f1 are same.
=>sed -n '/^.\(.\).*\(.\).$/\2\2/p' f1

13.To replace tybca with TYBCA in inputfile in.sh and write those line to output file out.sh
=>sed -n 's/tybca/TYBCA/g' in.sh > out.sh

14.To replace all occurences of 'she' with 'he' and 'hi' with 'hello'.
=>sed -n 's/she/he/g' 's/hi/hello/g' f1

15.To locate lines that begin and end with .(dot).
=>grep "^[.].*.$" f1

16.To display line 5 to 15,25 to 35 and last line of file f1.
=>sed -n -e '5,15p' -e '25,35p' -e '$p' f1

17.Write a command using awk to count number of occurence of pattern 'bca' in file f1.
=> awk -F "-" '{for(i=1;i<=NF;i++) if($i=="bca") c++} END {print c}' f1

18.Write a command using awk to print words whose length is greater than 4 character and consist digit only.
==>awk '{for(i=1;i4){print $i}}' f1

19.Write a command using awk to print even number of words in each line.
==>awk 'BEGIN{FS="|"}NR%2==0{print}'

===========================================================================================
2011(October/November)
===========================================================================================
01.Forcefully delete each file from directory tybca/my work.
=>rm -f hiren/hak/*

02.Show all hiden file from mydir/tybca.
=>ls -a|grep "^\."|sort

03.Sort filename by last access time from directory tybca/my work.
=> ls \tybca\'my work' -u

04.Rename file chap 1 to unit 1.
=>rm chap 1 unit 1

05.Find out number of lines of file chap01.
=>wc -l chap01

06.Find out mode number of file chap01.
=>ls -i chap01

07. Write a command to sort a line of file and also remove repeated line.
=>sort x1 -u

08.Write a command to locate the 'tybca' ignoring case.
=>grep -i "tybca" emp1

09.Write a command to display occurrence of string 'sales'.
=>grep -c "sales" emp1

10.Write a command to display line which start with "the".
=>grep "^the.*" emp1

11.Write a command to display line which end with "ia".
=>grep -i "ia$" test1
=>grep "*ia$" test1

12.Write a command to print first three line of file.
=>head -3 emp1

13.Write a coomand to substitute 'doshi' with 'desai'.
=>sed "s/doshi/desai/g" x1

===========================================================================================
2012(March-April)
===========================================================================================
01.To print first three line of file Tybca.
=>head -3 Tybca

02.To sort file by access time.
=>ls -u

03.To print field 1 and 6 from the Tybca
=>cut -d "|" -f 1,6 Tybca

04.To print Unique line of file Tybca
=>sort -u Tybca

05.To Print Frequency of each line from file Tybca.
=>sort test|uniq -c

06.To find file having size greater then five
=> ls -l|cut -c 24-27|grep -v "^[ ][ ][ ][0-4]*$"

07.To find a file having which have .c extension.
=>ls|grep "\.c"

08.Write a command to print lines which contain only TYBCA.
=>grep 'TYBCA' dept.lst

09.Write a command to print lines which not contain TYBCA.
=>grep -v 'TYBCA' dept.lst

10.Write a command to print lines 6 to 12.
=> sed -n '6,12p' dept.lst

11.Write a command to replace first occurrence of surat with vyara in each line.
=> sed 's/surat/vyara/' dept.lst

12.Write a command to print content of file after deleting every ;.
=>sed -e 's/;//g' x1

13.Write a command to sort column 3 to 5.
=>sed -n 3,5p x1|sort

14.Write a command to convert small alpabeticas to capital alphabetets.
=> tr "[a-z]" "[A-Z]" < test1

15.Write a command to print lines with line number which contain "marketing".
=>grep -i -n "marketing" x1

===========================================================================================
2012(October/November)
===========================================================================================
01.Count number of characters in first five lines of file x1.
=>head -5 x1|wc -c

02.To replace the word Computer with Computing of x1
=>sed "s\Computer\Computing\g" x1

03.Display lines whose last word is UNIX of file x1.
=>grep -i "unix$" x1

04.Display lines starting from 10th lines of file x1.
=>tail -n +10 x1

05.To Delete all special characters from the file x1.
=>tr -cd "[a-zA-Z0-9]*" grep "^[A-Za-z].*" x1

07.To remove a filename as x1 ?(x1 followed by ? character).
=> rm 'x1 ?'

08.To Display last line of file x1.
=>tail -1 x1

09.To deny execute permission to a group of file x1.
=>chmod g-x x1

10.To create link between file x1 and x1.link.
=>link x1 x1.link

11.To run Script X1 in background so that its execution continue even user logout from the system
=>

===========================================================================================
2013(March-April)
===========================================================================================
01. Display lines 10 to 15 from files x1.
=>sed -n 10,15p x1

02. Display last word of each line from a file x1.
=>tr "\012" ";" tail -1 x1|wc -c

04. To count number of words in line 40 thought 60 from the file f1.txt .
=>head -60 f1.txt|tail -20|wc -w

05. To delete all special characters from the file x1.
=>tr -cd "[0-9a-zA-Z]*" grep '^[l|Ee|Tt].*' x1.1
=>grep '^l[Ee|Tt].*' x1.1

07.Display the lines which are not starting with 2 at the begining.
=>grep -v "^2" emp

08.Display lines having exactly 50 character in file x1.
=>grep '^.\{50\}$' x1

09.count number of blank lines in file x1.
=>grep -c '^$' x1

10.Display lines having at least one * character in file x1.
=>grep '^*' x1

11.Display lines from file x1 that containing string "UNIX" or "unix" or "Unix" .
=>grep -c '^UNIX\|Unix\|unix$' x1 \\ to count
=>grep -i '^unix$' x1 \\ to Display

12.Display the directory listing.
=>ls -l|grep "^d"

13.Substitute 'endif' with 'fi' on line 10 of file x1.
=> sed '10s/endif/fi/' x1

14.Display two line starting from 7th line of file x1.
=> sed -n 7,+1p x1

15.Display all the line before string "Unix" from file x1.
=>

16.Display all blank lines between line 20 and 30 of file x1.
=>sed -n 20,30p x1|grep "^$"

17.Display line beggining either with alphabet or digit from file x1.
=>grep "^[a-zA-Z0-9]" x1

18.Display the lines that do not contain "Unix".
=>grep -i -v "unix" emp

===========================================================================================
2013(October/November)
===========================================================================================
01.Remove duplicate line from a file.
=> sort -d emp|uniq

02.To count number of characters in last line file x1.
=>tail -1 emp|wc -cs

03.Display the processes of user 'bca0 I'.
=>ps -u 'bca0 I'

04.List the user from /etc/passwd in the alphabrtically sorted order.
=>sort -d /etc/passwd

05.Count the frequency of users who are logged in from more than one terminal.
=>who|cut -d " " -f 1|sort |uniq -d

06.Display string in upper case of file f1.txt.
=>tr "[a-z]" "[A-Z]" grep "accounts" emp

08.Write a command to print lines which do not contain 'accounts'.
=> grep -v "accounts" emp

09.Write a command to print lines 10 to 15.
=>sed -n 10,15p x1

10.Write a command to substitute 'doshi' with 'desai'.
=>sed "s/doshi/desai/g" x1

11.Write a command to print lines with line numbers which contain "Marketing".
=>grep -n "Marketing" emp|cat -n

12.Write a command to display line which starts with 'the'.
=>grep "^e" emp

13.Write a script to display the user login ids,their home directories and login shells from the "etc\password" file.
=> cat etc/passwd|cut -d ":" -f 1,6,8

14.Switch the first two fields in each line of text and put the result in new file.
=> awk 'BEGIN{FS="-"}{print $2,$1}' emp1>switchf

15.To only print lines where in the first field had a numeric value less then 20.
=> awk 'BEGIN{FS="-"}{if($1<20){print}}' emp1

===========================================================================================
2014(March-April)
===========================================================================================
01.Write a Command to Print First Seven Line of File
=>head -7 x1

02.Write a Command to sort Line of File and Also Remove Repeated Line.
=>sort -u x1

03.Replace all Occurrences of "SYBCA" with "TYBCA" in 5th line of file f1.
=>sed '5s/SYBCA/SYBCA/g' f1

04.count all Occurrences of "TYBCA" in studlst
=>grep -c "TYBCA" studlst

05.Replace "kernel" with "kernel architecture" using remember pattern of sed utility.
=>sed 's/kernel/kernel architecture/g' f1

06.To run a Utility x1 at 9:00 AM
=>at 9:00

07.Write a Command to Locate the "Unix" ignoring case.
=>grep - i "Unix" studlst

08.Write a Command to display occurence of string "tybca".
=>grep -c "tybca" studlst

09.Write a Command to display line which start with "The".
=>grep -i "^The*" studlst

10.Write a Command to display line which end with "India".
=>grep -i "*India$" studlst

11.Write a command to print first six line of file.
=>head -6 studlst

12.Print even number of words in each line.
=>awk 'BEGIN{FS="-"}{for(i=1;i<=NF;i++){if(i%2!=0){print $i}}}' emp1

13.Count occurence of pattern "Operating System" in file f1.
=> awk -F "-" '{for(i=1;i<=NF;i++) if($i=="Operating System") c++} END {print c}' emp1

14.Display those Words whose length greater than 10 character and consist of alphabet only.
=> awk 'BEGIN{FS="-"}{for(i=1;i<=NF;i++){if(length($i)>10){if($i~/^[a-zA-Z]+/){print $i}}}}' emp1
===========================================================================================
2014(October/November)
===========================================================================================
01.Display two lines Starting From 7th line of file x1.
=>sed -n 7,9p x1

02.Display All Blank lines Between Line 20 and 30 of file x1.
=>sed -n 4,8p test|grep "^$"

03.Display lines Beginning either with Alphabet or Digit from file x1.
=>grep "^[a-zA-z0-9]" x1

04.Display the lines that do not contain "Unix".
=>grep -i -v "Unix" x1

05.Display the Lines which are not strating with 2 at the begging.
=>grep -v "^2" x1

06.Write a command to replace "UNIX" with "OS" on line no 5th to 10th.
=>sed '5,10s/UNIX/OS/g' x1

07.Write a Command to display all file name Containing only digit in filename.
=>ls - l|grep "^[0-9]*$"

08.To list file names consist of only 4 digits.
=>ls -1|grep "^[0-9][0-9][0-9][0-9]$"

09.To display lines beginning with Alphabets of file x1.
=>grep "^[a-zA-Z]" x1

10.To count number of words in line 40 thought 60 of line f1.txt
=>sed -n 4,8p test|wc -w

11.Print odd number of words in each line.
=>awk 'BEGIN{FS="-"}{for(i=1;i<=NF;i++){if(i%2==0){print $i}}}' emp1

12.Count occurence of pattern "unix" in file f1.
=> awk -F "-" '{for(i=1;i<=NF;i++) if($i=="unix" ) c++} END {print c}' emp1

13.Display those Words whose length greater than 10 character and cosist of alphabet only.

14.Print lines which end with 5,6,7 from file f1.
=> awk '/[5,6,7]$/' f1

15.Write awk script to print 1 to 10.
=> awk 'BEGIN {for(i=1;i<=10;i++){print i}}'

16.Write a command to print those lines where field2 is computer field 3>15000 from sales file.

17.Print lines no 18 to 30 from f1.txt.
=>awk '{if(NR >= 18 && NR <= 30){print}}' f1.txt

18.Count the total no of lines in file.
=>awk '{print NR}' emp1|tail -1

===========================================================================================
2015(March-April)
===========================================================================================
01.Display all files in current directory where the first character is numeric and the last cheracter is not alphabetic.
=>ls -1|grep "^[0-9].*"|grep -v "[a-z]$"

02.To count number of words in line 40 thought 60 of file f1.txt
=>sed -n 40,60p f1.txt|wc- w

03.To list file names consist of only 4 digit.
=>ls -1|grep "[0-9][0-9][0-9][0-9]"

04.To display lines begining with alphabets of a file x1.
=>grep "^[A-Za-z]" x1

05.Display all blank lines between line 20 and 30 of file x1.
=>sed -n 20,30p x1|grep "^$"

06.Display line beggining either with alphabet or digit from file x1.
=>grep "^[a-zA-Z0-9]" x1

07.Display the lines that do not contain "Unix".
=>grep -i -v "unix" emp

08.Display the number of occurance of the pattern 'director'.
=>grep -ci "director" emp

09.Display lines having exactly 50 character of file x1.
=>grep ".\{50\}$" x1

10.Write a command to append a dashed line after each line of file x1.
=>sed "s/$/-/g" x1

11.Print the even numbered lines in the data file.
=>awk 'NR%2==0{print}' emp1

12.Print the sums of fields of every line in file f1.
=> awk 'BEGIN{FS="-"}{print NF}' f1

13.Display those words whose length greater than 10 characters and consists of digit only.
=> awk 'BEGIN{FS="-"}{for(i=1;i<=NF;i++){if(length($i)>10){if($i~/^[0-9]+/){print $i}}}}' emp1

14.Write awk script to print 10 to 1 using while loop.
=> awk 'BEGIN{ $i = 10;while ( $i > 0 ){print $i;$i--; }}'

15.Print lines no 18 to 30 from f1.txt.
=> awk '{if(NR >= 18 && NR <= 30){print}}' f1.txt

16.Count the total no of lines in file.
=>awk '{print NR}' emp1|tail -1

17.Count occurrences of pattern "Unix OS" in file f1.
=> awk -F "-" '{for(i=1;i<=NF;i++) if($i=="Unix OS" ) c++} END {print c}' f1

18.Print the last Field of last Line.
=> tail -1 emp1|awk -F "-" '{print $NF}'

===========================================================================================
2015(October/November)
===========================================================================================
01.Display line 1 to 5 from file x1.
=> head -5 x1

02.Dispaly last word of each line from a file x1.
=> cat -d "-" -f 6 x1

03.To count number of characters in first line of file x1.
=> head -1 x1|wc -c

04.To count number of words in line 40 through 60 of file f1.txt.
=> sed -n "40,60 p" f1.txt|w c -w

05.To delete all special characters from file x1.
=> tr -cd "[a-zA-Z0-9]" grep -i "let" x1

07.Substitute 'endif' with 'fi' on line 10 of file x1.
=> sed "s/endif/fi/gp" x1|sed -n "10,0 p"

08.Display three lines starting from 5th line of file x1.
=> sed -n "5,+2 p" x1

09.Display all line before string "Unix" from file x1.
=> sed -n "/^unix/p" x1

10.Display all blank line between line 10 and 20 of file x1.
=> sed -n "10,20 p" x1|sed -n "/^$/p"

11.Display lines beginning either with alphabet or digit from file x1.
=> sed -n "/^[a-z-A-Z0-9]/p" x1

12.Display the lines that do not contain "Unix".
=> grep -v "Unix" f1

Shell Script

===========================================================================================
2010(March/April)
===========================================================================================
01.Write a menu driven script for the following option.an intger or float number should be accepted from user.proper validation must be expected
1)convert decimal to binary number
2)convert decimal to octal number
3)convert decimal to hexadecimal number
==>
while [ -z $n ]
do
echo "enter any number"
read n
done
if [ $n -gt 0 && $n -lt 4]
then
echo "1 for Decimal to Binary"
echo "2 for Decimal to Octal"
echo "3 for Decimal to Hexa"
case "$ch" in
1) echo "ibase=10;obase=2;$n"|bc;;
2) echo "ibase=10;obase=8;$n"|bc;;
3) echo "ibase=10;obase=16;$n"|bc;;
*)echo "invalid choice"
sh convert.sh
esac
else
echo "Number Must Be Positive"
sh convert.sh
fi
-----------------------------------------------------------------------------------------------------------------------------------------------------
02.Write a script using awk utility to display file contents in toggle case.Assume that file should be passed from command line.
==>
if $
-----------------------------------------------------------------------------------------------------------------------------------------------------
03.Write a script that removes all empty file in current working directory.appropriate data validation is expected.
==>
find -empty -type f -exec rm {} \;
===========================================================================================
2010(October/November)
===========================================================================================
01.Write a script to perform Mathematical Operations Using Menu.Number may be integer or float.
1)Addition
2)Substraction
3)Multiplication
4)Division
==>
echo "1 For Addition"
echo "2 For Substraction"
echo "3 For Multiplication"
echo "4 For Division"
echo "Select Option : \c"
read n
echo "Enter Value of A :\c"
read a
echo "Enter Value of B :\c"
read b
case "$n" in
1)echo "Sum of A and B :" `expr $a+$b|bc`
;;
2)echo "Substration of A and B : " `expr $a-$b|bc`
;;
3)echo "Multiply of A and B : " `expr $a*$b|bc`
;;
4)echo "Division of A and B :" `expr $a/$b|bc`
;;
*)echo "Invalid Choice"
esac
-----------------------------------------------------------------------------------------------------------------------------------------------------
02.Write a script that receive string and check both ar same or different.also check the length of both string are greater than 0.
==>
echo "Enter String 1 : \c"
read str1
echo "Enter String 2 : \c"
read str2
l1=`expr "$str1" : '.*' `
l2=`expr "$str2" : '.*' `
if [ $l1 -gt 0 -a $l2 -gt 0 ]
then
if [ $str1 = $str2 ]
then
echo "Both String Are Same"
else
echo "Both String Are Not Same"
fi
else
echo "\nEnter Proper String"
sh strsame
fi
-----------------------------------------------------------------------------------------------------------------------------------------------------
03.Write a script to enter 5 subjects mark from command line and display percentage and appopriate class.
==>
if [ $# -ne 5 ]
then
echo "Invaild number of argument"
else
s1=$1
s2=$2
s3=$3
s4=$4
s5=$5

tot=`expr $s1 + $s2 + $s3 + $s4 + $s5`
per=`echo " $tot / 5 " | bc`

echo "Total is:- $tot"
echo "Percetage is:- $per"

if [ $per -ge 70 ]
then
echo "Distinction....!"
elif [ $per -ge 60 ]
then
echo "First Class....!"
elif [ $per -ge 50 ]
then
echo "Second Class....!"
elif [ $per -ge 40 ]
then
echo "Third Class....!"
else
echo "Fail.....!"
fi
fi
-----------------------------------------------------------------------------------------------------------------------------------------------------
04.Write a script to check entered character is uppercase,lowercase,numeric,digit or special character.
==>
echo "Enter Any Character"
read c
case "$c" in
[A-Z])echo "Character is Uppercase"
;;
[a-z])echo "Character is Lowercase"
;;
[0-9])echo "Character is Numeric"
;;
*)echo "Character is Special"
esac
===========================================================================================
2011(March/April)
===========================================================================================
01.Write a shell Script to Check the Entered No is Palindrome or Not.
==>
echo "Enter No Please"
read n
r=0
d=0
a=$n
while [ $n -gt 10 ]
do
d=`echo $n % 10|bc`
r=`echo $r \* 10 + $d|bc`
num=`echo $n/10|bc`
done
d=`echo $num % 10|bc`
r=`echo $r \* 10 + $d|bc`
if [ $a -eq $r ]
then
echo "pelindrom"
else
echo "not palindrom"
fi
-----------------------------------------------------------------------------------------------------------------------------------------------------
02.Write a script using awk utility to create two 3*3 matrix and multiply it.
-----------------------------------------------------------------------------------------------------------------------------------------------------
==>
BEGIN{
printf �dimentions of matrix�
printf �enter the values of r1:�
getline
r1=$0
printf �enter the value of c1�
getline
c1=$0
printf �enter the values of r2:�
getline
r2=$0
printf �enter the value of c2�
getline
c2=$0

if(c1!=r2)
{
Printf �please enter c1 & r2 must same!!�
Exit

}
Printf �enter value of matrix�
For(i=1;i<=r1;i++)
{
For(j=1;j<=c1;j++)
{
Printf �enter value of [%d][%d] : �,I,j
Getline
A[I,j]=$0
}
}
Printf �enter value of matrix�
For(i=1;i<=r2;i++)
{
For(j=1;j<=c2;j++)
{
Printf �enter value of b[%d][%d] : �,I,j
Getline
B[I,j]=$0
}
}

Printf �matrix a�
For(i=1;i<=r1;i++)
{
For(j=1;j<=c1;j++)
{
Printf � %d �,b[I,j]
}
Printf ��
}

Printf �multiplication�
For(i=1;i<=c1;i++)
{
For(j=1;j<=r2;j++)
{
For(k=1;k<=r1;k++)
{
C[I,j]+=a[I,k]*b[k,j]
}
Printf � %d �,c[I,j]
}
Printf ��
}

===========================================================================================
2011(October/November)
===========================================================================================
01.Write a shell Script to Check the Entered No is Armstrong or Not.
==>
echo "Enter any number ";
read no
t=$no
sum=0

while [ $no -gt 0 ]
do
d=`expr $no % 10`
sum=`expr $sum + $d \* $d \* $d`
no=`expr $no / 10`
done
if [ $t -eq $sum ]
then
echo "number is armstrong";
else
echo "number is not armstrong";
fi
===========================================================================================
2012(March/April)
===========================================================================================
01.Write a shell Script to Check the Entered No is Palindrome or Not.
==>
echo "Enter No Please"
read n
r=0
d=0
a=$n
while [ $n -gt 0 ]
do
d=`echo $n % 10|bc`
r=`echo $r \* 10 + $d|bc`
num=`echo $n/10|bc`
done
d=`echo $num % 10|bc`
r=`echo $r \* 10 + $d|bc`
if [ $a -eq $r ]
then
echo "pelindrom"
else
echo "not palindrom"
fi
===========================================================================================
2012(October/November)
===========================================================================================
01.Write a shell script which displays list of all files in current dirrectory to which you have read write and execute permissions.
==>
for file in *
do
if [ -r $file -a -w $file -a -x $file ]
then
echo $file
fi
done
-----------------------------------------------------------------------------------------------------------------------------------------------------
02.Write a script that removes all empty file in current working directory.appropriate data validation is expected.
==>
find -empty -type f -exec rm {} \;
-----------------------------------------------------------------------------------------------------------------------------------------------------
03.Write awk script to display file contents in reverse.(last line should be displayed first ..first line should be displayed last).
awk '{ a[ i++ ]=$0}
END{for( j=i-1; j>=0; j-- )
print a[ j ];}' nidhi1
===========================================================================================
2013(March/April)
===========================================================================================
01.Write a shell Script to Check the Entered No is Palindrome or Not.
==>
echo "Enter No Please"
read n
r=0
d=0
a=$n
while [ $n -gt 10 ]
do
d=`echo $n % 10|bc`
r=`echo $r \* 10 + $d|bc`
num=`echo $n/10|bc`
done
d=`echo $num % 10|bc`
r=`echo $r \* 10 + $d|bc`
if [ $a -eq $r ]
then
echo "pelindrom"
else
echo "not palindrom"
fi
-----------------------------------------------------------------------------------------------------------------------------------------------------
02.Write A shell Script That Accept two Decimal Numbers from Keyboard and Display Their Sum in Hexadecimal Form.``Make Proper Validation
==>
echo "Enter Value 1 : \c"
read d1
echo "Enter Value 2 : \c"
read d2
if [ $d1 -eq '[0-9]' ]
then
echo "Invalid Input"
fi
echo "Sum In Hexadecimal Format : \c"
echo "ibase=10;obase=16;$d1+$d2"|bc
===========================================================================================
2013(October/November)
===========================================================================================
01.Write a script to perform Mathematical Operations Using Menu.
==>
echo "1 For Addition"
echo "2 For Substraction"
echo "3 For Multiplication"
echo "4 For Division"
echo "Select Option : \c"
read n
echo "Enter Value of A :\c"
read a
echo "Enter Value of B :\c"
read b
case "$n" in
1)echo "Sum of A and B :" `expr $a+$b|bc`
;;
2)echo "Substration of A and B : " `expr $a-$b|bc`
;;
3)echo "Multiply of A and B : " `expr $a*$b|bc`
;;
4)echo "Division of A and B :" `expr $a/$b|bc`
;;
*)echo "Invalid Choice"
esac
-----------------------------------------------------------------------------------------------------------------------------------------------------
02.wrie a shell script to check whether the given file is empty or not.
==>
echo "Enter file name to check is empty or not read"
read file1
if test -s $file1
then
echo "$file1 is non empty file"
else
echo "$file1 is empty file"
fi
02.Write a shell script to test the file is a empty file or not.
===========================================================================================
2014(March/April)
===========================================================================================
01.Write a shell script to validate the name of a person Accepted through the keyboard so that it does not exceed 10 char of length.
==>
echo "\n Enter Name = \c"
read n
l=`expr "$n" : '.*'`

if [ $l -ge 10 ]; then
echo "Name Must be Less Then 10 Char..!"
else
echo "Hello "$n
fi
-----------------------------------------------------------------------------------------------------------------------------------------------------
02.Write a shell script to test the file is a executable file or not.
==>
echo "Enter a file name::"
read f
if test -x $f
then
echo "file is a executable.."
else
echo "file is not executable..."
fi
-----------------------------------------------------------------------------------------------------------------------------------------------------
03.write a shell script to find smallest of three number that are read from keyword.
echo "Enter number A"
read a
echo "Enter number B"
read b
echo "Enter number C"
read c
if test $a -lt $b && test $a -lt $c
then
echo "A is smallest number."

elif test $b -lt $c && test $b -lt $a
then

echo "B is smallest number"

else
echo " C is smallest number"
fi
===========================================================================================
2014(October/November)
===========================================================================================
01.Reverse a number.
==>
echo "Enter Number: "
read no
d=0;
cop=$no;
su=0;
while [ $no -gt 0 ]
do
d=`expr $n0 % 10`;
su=`expr $su \* 10 + $d`;
no=`expr $no / 10`;
done

if [ $su -eq $cop ]
then
echo "$no is palindrom...";
else
echo "$no is not palindrom...";
if
-----------------------------------------------------------------------------------------------------------------------------------------------------
02.write a script to find smallest that are read from keyboard.
==>
echo "Enter the value of a:"
read a
echo "Enter the value of b:"
read b
echo "Enter the value of c:"
read c
if test $a -lt $b && test $a -lt $c
then
echo "$a is smallest..."
elif test $b -lt $a && test $b -lt $c
echo "$b is smallest..."
else
echo "$c is smallest.."
fi
===========================================================================================
2015(March/April)
===========================================================================================
01.Write a script to count a file,directory,symbolic link file from current directory.
==>
for file in `ls`
do
if test -f $file
then
f=`expr $f + 1`
elif test -d $file
then
d=`expr $d + 1`
elif test -l $file
then
l=`expr $l + 1`
fi
done
echo "files : $f"
echo "dirctory : $d"
echo "link : $l"
-----------------------------------------------------------------------------------------------------------------------------------------------------
02.Write a script that accept a string followed by one or more file names from command line and display
number of word and number of links tht consists of given string in each file .
==>
for i in $#
do
l=`cat $1i | wc -l`
w=`cat $i | wc -w`
echo "total link are in file $i is : $l"
echo "total words are in file $i is : $w"
done

===========================================================================================
2015(October/November)
===========================================================================================
01.Reverse a number is palindrom or not.
==>
echo "Enter Number: "
read no
d=0;
cop=$no;
su=0;
while [ $no -gt 0 ]
do
d=`expr $n0 % 10`;
su=`expr $su \* 10 + $d`;
no=`expr $no / 10`;
done
if [ $su -eq $cop ]
then
echo "$no is palindrom...";
else
echo "$no is not palindrom...";
if
-----------------------------------------------------------------------------------------------------------------------------------------------------
03.write a shell script to test that the file is a readable file or not.
==>
echo "Enter file name to check is empty or not read"
read file1
if test -r $file1
then
echo "$file1 is readable"
else
echo "$file1 is not readable"
fi

=================================================================================================================================================
=================================================================================================================================================

sub PHP

Atest/index.php


User login page



Log In




Enter your login details here






Loged In



form.txt

User Details Form



User Details Form


Roll No:



Name:



Email:



Phone No:



Address:



Gender:

Male

Female


Age:



Hobbies:

Reading

Writing

Drawing


Collage Year:

Select Year
".$row['year']."";
}
?>






insert.txt

" . mysqli_error($conn);
}
mysqli_close($conn);
?>

update.txt

delete.txt

edit.txt

Edit User Details




Edit User Details



Name:



Email:



Phone No:



Address:



Gender:
required>
Male
required>
Female


Age:



Hobbies:
>
Reading
>
Writing
>
Drawing


Collage Year:

Select Year
".$row1['year']."";
} else {
echo "".$row1['year']."";
}
}
?>






display.txt

User Details




Roll No
Name
Email
Phone No
Address
Gender
Age
Hobbies
Collage Year
Action

";
echo "".$row['rollno']."";
echo "".$row['name']."";
echo "".$row['email']."";
echo "".$row['phno']."";
echo "".$row['adr']."";
echo "".$row['gender']."";
echo "".$row['age']."";
echo "".$row['hobbies']."";
echo "".$row['collageyear']."";
echo "Edit | Delete";
echo "";

}
?>

Add Record

=================================================================================================================================================
=================================================================================================================================================

sub VB.net

code
frmcstmst.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="frmcstmst.aspx.vb" Inherits="frmcstmst" %>



.style1
{
width: 100%;
background-color: #808080;
height: 734px;
}
.style2
{
height: 26px;
}
.style3
{
width: 222px;
}
.style4
{
height: 26px;
width: 222px;
}
#form1
{
height: 741px;
width: 1398px;
}







Enter customer details

 



name







address






Contect number






Enter image















 

 



 
















frmcstmst.aspx.vb

Imports System.Data
Imports System.Data.SqlClient
Partial Class frmcstmst
Inherits System.Web.UI.Page

Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim intid As Integer

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
con.ConnectionString = ConfigurationManager.ConnectionStrings("constr").ToString
cmd.Connection = con
fillgrid()
Catch ex As Exception
lblmsg.Text = ex.Message()
End Try
End Sub

Protected Sub gv_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gv.PageIndexChanging
gv.PageIndex = e.NewPageIndex
fillgrid()
End Sub

Protected Sub gv_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles gv.RowCancelingEdit
gv.EditIndex = -1
fillgrid()
End Sub

Protected Sub gv_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles gv.RowDeleting
intid = gv.DataKeys(e.RowIndex).Value
Try
cmd.CommandText = "delete from tblcst where id = " & intid & ""
con.Open()
cmd.ExecuteNonQuery()
con.Close()
lblmsg.Text = "Record is deleted"
fillgrid()
Catch ex As Exception
lblmsg.Text = ex.Message()
End Try
End Sub

Protected Sub btnsave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsave.Click
Dim FPL As String
Dim sqlCheckCommand As New SqlCommand("SELECT COUNT(*) FROM tblcst WHERE cname = '" & txtname.Text & "'", con)
Try
con.Open()
Dim nameCount As Integer = CInt(sqlCheckCommand.ExecuteScalar())
cmd.ExecuteNonQuery()
con.Close()
If nameCount > 0 Then
' Name already exists, show message box
lblmsg.Text = "Name already exists in the table!"

Else
If fu.HasFile Then
fu.SaveAs(Server.MapPath("~img") + fu.FileName)
lblimg.Text = "~img" + fu.FileName
End If
FPL = "~img" + fu.FileName
cmd.CommandText = "insert into tblcst values('" & txtname.Text & "' ,'" & txtadd.Text & "','" & txtphno.Text & "','" & FPL & "')"
con.Open()
cmd.ExecuteNonQuery()
con.Close()
fillgrid()
End If
Catch ex As Exception
lblmsg.Text = ex.Message()
End Try
End Sub

Sub fillgrid()
Try
cmd.CommandText = "select * from tblcst"
Dim dt As New DataTable
Dim da As New SqlDataAdapter(cmd)
da.Fill(dt)
gv.DataSource = dt
gv.DataBind()
Catch ex As Exception
lblmsg.Text = ex.Message()
End Try
End Sub

Sub clear_controls()
txtname.Text = " "
txtadd.Text = " "
txtphno.Text = " "
End Sub

Protected Sub btnclear_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnclear.Click
Try
clear_controls()
Catch ex As Exception
lblmsg.Text = ex.Message()
End Try
End Sub

Protected Sub gv_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gv.RowEditing
gv.EditIndex = e.NewEditIndex
End Sub

Protected Sub gv_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gv.RowUpdating
Dim tn, ta, tc As New TextBox
Dim intid As Integer = gv.DataKeys(e.RowIndex).Value
tn = gv.Rows(e.RowIndex).Cells(2).Controls(0)
ta = gv.Rows(e.RowIndex).Cells(3).Controls(0)
tc = gv.Rows(e.RowIndex).Cells(4).Controls(0)
Try
cmd.CommandText = "update tblcst set canme ='" & tn.Text & "' , add = '" & txtadd.Text & "' , phno=" & txtphno.Text & " where id = " & intid & ""
con.Open()
cmd.ExecuteNonQuery()
con.Close()
fillgrid()
Catch ex As Exception
lblmsg.Text = ex.Message()
End Try
End Sub
End Class

=================================================================================================================================================
=================================================================================================================================================