Update:
I have made this script that probably is doing what I want.
#!/bin/bash
sudo LC_ALL=C | pacman -Sl extra | grep installed | cut -d" " -f2 >> installed-extra.txt
#sudo LC_ALL=C | pacman -Sl world | grep installed | cut -d" " -f2 >> installed-world.txt
sudo LC_ALL=C | pacman -Sl world | cut -d" " -f2 >> world-allpkgs.txt
awk 'NR==FNR{arr[$0];next} $0 in arr' installed-extra.txt world-allpkgs.txt >> tobe-installed.txt
awk '{print "world/" $0}' tobe-installed.txt >> pacman-list.txt
It will produce "pacman-list" with packages installed in extra that are present in world, prefixed with "world/" as follow:
world/a52dec
world/aalib
world/abseil-cpp
I have to feed to to pacman this list to be installed, but I have to specify that they have to be reinstalled
I have found this command on Arch Linux Wiki:
pacman -S --needed - < pkglist.txt
Will it perform the desired action? Ie it will install packages from world reinstalling them on top of the extra one?
or I have to add some other options?
TIA and Regards
Carlo D.