Help to Add and Remove Records only from first line/last line

Hi,

I need help with a maybe total simple issue but somehow I am not getting it.

I am not able to etablish a sed or awk command which is adding to the first line in a text and removing only from the last line the ",".

The file is looking like follow:

TABLE1,
TABLE2,
.
.
.
TABLE99,

In the end it should look like follow:

TABLE=TABLE1,
TABLE2,
.
.
.
TABLE99

I am thankfull for any help.

I am working with ksh

Hi enjoy,

Please try with this:

sed '1s/^/TABLE=/' inputfile | sed '$s/,//'

Hope it helps.

Great :slight_smile: it works, thx for fast answer!

Warning : UUoC !!!, please use:

sed '1s/^/TABLE=/;$s/,$//' file

it didn�t work completly, the "$" was to much after the ","

I changed it from

sed '1s/^/TABLES=/;$s/,$//' EXP_tmp.par > EXP.par 

too

sed '1s/^/TABLES=/;$s/,//' EXP_tmp.par > EXP.par

thx for the reply !

regards
sandra