Uma maneira de usar sed
:
Conteúdo de script.sed :
## Change line.
s/.*/('&','&')/
## Append it to hold space.
H
## In end of file substitute newlines with commas and print.
$ {
g
s/^\n//
s/\n/,/g
p
}
Comando:
sed -nf script.sed infile
Saída:
('chair','chair'),('table','table'),('pen','pen'),('desk','desk')