plugging out value from a textfile

Hi,
need some help from all of you as i'm a beginner in shellscript. Currently i have a textfile(filename.txt) with the below content:

TOTAL: 30
RECORDS: 300
anyone one know how do i plug out the value of 30 and put into a variable(var1) and 300 into another variable(var2)?I'm coding using ksh script.

Thanks.

{
read v1
read v2
var1="${v1#* }"; echo "var1 is $var1"
var2="${v2#* }"; echo "var2 is $var2"
}<filename.txt

Or with bash (and ksh93?):

a=($(<filename.txt))
var1="${a[1]}"
var2="${a[3]}"

Hi radoulov ,
What does #* means? will the word "TOTAL" and "RECORDS" be capture into the variable if i do not do a find using "TOTAL" and "RECORDS"?
What if in my textfile contains the below:
----------------------------------------
Testing onee
Testing two
TOTAL: 30
RECORDS:300

Do i need to use 'grep' to find the word "TOTAL" & "RECORDS" to plug out the 30 and 300 into the variables?
Thanks.

My post was based on the input provided.
Given your second example:

while read;do 
	case "$REPLY" in 
		TOTAL:*) var1="${REPLY#*:}" ; echo "var1 is $var1";; 
		RECORDS:*) var2="${REPLY#*:}"; echo "var2 is $var2";; 
	esac 	
done < filename.txt

Hi,
How do i code to remove for example this sentence "PL/SQL procedure successfully completed." in a text file?I need to find this sentence and remove it.

Thanks.

Disable feedback in sqlplus (set feed off) :slight_smile:

Hi radoulov,
Thanks so much for your help !