Results 1 to 1 of 1
I have the following file:
database1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 111.111.111.22) (PORT = 1234))
(CONNECT_DATA = (SID = database1))
)
I need to change ...
- 07-08-2010 #1Just Joined!
- Join Date
- Jul 2010
- Posts
- 3
using grep on array cell
I have the following file:
database1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 111.111.111.22) (PORT = 1234))
(CONNECT_DATA = (SID = database1))
)
I need to change the last line with a value I am reading from a user:
echo '(CONNECT_DATA = (SERVICE_NAME = $srv_na )'
I am reading the file to an array but I am not sure if I can grep the string out of the array cell
cat file1 | while read line
do
file1_array[i]=$line
let i=${i}+1
echo '$file1_array[i]'
grep -w CONNECT_DATA $file1_array[i]
if [ $? -eq 0 ]
then
$file1_array[i] = echo '(CONNECT_DATA = (SERVICE_NAME = $srv_na )'
fi
done
Any suggestions will be appreciated


Reply With Quote