Another funny solution, using perl :
$ cat file.txt
aaa
bbb
ccc
$ perl -pe 's/.*/\047$&\047/; !eof && s/\n/\$label OR /g' file.txt
'aaa'$label OR 'bbb'$label OR 'ccc'
This have the advantage to have a very clear syntax, isn't it ?
-pe
stands forprint
by default (likesed
) & assumingwhile (<>) {}
equivalent\047
stands for octal representation of single quote'
!eof
stands forif the EOF is not reached
s///
is the basic skeleton for a sed like substitution