Change the file format

gpio_rw = gpiochip162
audio_aplay = HDMI_0
audio_aplay = HDMI_1
audio_aplay = HDMI_2
graphic_xrandr_show = USB1
graphic_xrandr_show = USB2
graphic_xrandr_show = USB3
graphic_change_resolution = eDP1
gpio_rw = "gpiochip162"
audio_aplay = "HDMI_0 HDMI_1 HDMI_2"
graphic_xrandr_show = "USB1 USB2 USB3"
graphic_change_resolution = "eDP1"

Any attempt from your side?

just want to duplicated items to one line with ""

Hello yanglei_fage,

Following may help you in same.

awk -vs1="\"" -F"=" '{gsub(/[[:space:]]/,Y,$2); X[$1]=X[$1]?X[$1] OFS $2:$2} END{for(i in X){print i " = "s1 X s1}}' Input_file

Output will be as follows.

audio_aplay  = "HDMI_0 HDMI_1 HDMI_2"
graphic_change_resolution  = "eDP1"
graphic_xrandr_show  = "USB1 USB2 USB3"
gpio_rw  = "gpiochip162"

EDIT: Sorry RudiC I haven't seen reply from you as seems I was replying to the thread on same time.

Thanks,
R. Singh