Hi Gurus,
I have 2 files
File1 :
veg apple
ap
pl
le
end
veg orange
or
an
ge
end
File2:
apple
orange
I had written a script to fetch data "veg" till "end"
for i in `cat file2.txt`
do
sed -n '/'veg $i'/,/end/p' file1.txt >> $i.txt
done
But when i execute this script, i am getting the following error "sed: -e expression #1, char 9: unterminated address regex"
Expected ouput:
veg apple
ap
pl
le
end
veg orange
or
an
ge
end
Can someone help me out with this ? How do i leave that space between "veg" and "$i" ?