32. WASS to accept 2 file names if both exits and not empty then concatenate both and store the content in a file called merged.txt
Page 1 of 1
32. WASS to accept 2 file names if both exits and not empty then concatenate both and store the content in a file called merged.txt
clear
count=0
echo "Enter a filename:"
read file1
if test -s file1
then
echo "File exists and is non-empty"
count=`expr $count + 1`
else
echo "File doesn't exist"
fi
echo "Enter another filename:"
read file2
if test -s file2
then
echo "File exists and is non-empty"
count=`expr $count + 1`
else
echo "File doesn't exist"
fi
if test $count=2
then
cat file1 file2 > merge.txt
fi
count=0
echo "Enter a filename:"
read file1
if test -s file1
then
echo "File exists and is non-empty"
count=`expr $count + 1`
else
echo "File doesn't exist"
fi
echo "Enter another filename:"
read file2
if test -s file2
then
echo "File exists and is non-empty"
count=`expr $count + 1`
else
echo "File doesn't exist"
fi
if test $count=2
then
cat file1 file2 > merge.txt
fi
1987ronnie- Posts : 3
Join date : 2010-07-20
Similar topics
» 15 Program - WASS to accept 10 names and stores in a file called NAME.DBF
» 7. WASS to accept a file name and convert its content to uppercase
» 39. WASS which accept a file name and print last 10 lines of the file
» 8. WASS to accept 2 x and y , and find the XY ( x raised to the power y )
» WASS to accept a string from the user and display number of vowels
» 7. WASS to accept a file name and convert its content to uppercase
» 39. WASS which accept a file name and print last 10 lines of the file
» 8. WASS to accept 2 x and y , and find the XY ( x raised to the power y )
» WASS to accept a string from the user and display number of vowels
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum