Adding semicolon at the end of each line

Hi,
I have a script which I need to change. I want to add a semicolon at the end of each line where the line starts with "grant"

for e.g.

create table(....
);
grant  select on TABL1 to USER1
grant  select on TABL1 to USER2

should become

create table(....
);
grant  select on TABL1 to USER1;
grant  select on TABL1 to USER2;

Thanks in advance.

Hi,Try this one,

awk '/^grant/{$0=$0";";}1' file

Cheers,Ranga:-)

Thanks Ranga. This works. :b:

sed solution:

sed '/^grant/ s/$/;/' file