I'm trying to read the filtered output of the command into the array, but this results in an empty array. When I read the command into the array without the filter the array gets filled fine.
What am I missing here?
The regular output of the command:
gst-device-monitor-1.0 -f Source/Network:application/x-ndi
Probing devices...
Monitoring devices, waiting for devices to be removed or new devices to be added...
Device found:
name : PRO-CONVERT HDMI-NDI 001 (#00 (A405200518097))
class : Source/Audio/Video/Network
caps : application/x-ndi
properties:
ndi-name = "PRO-CONVERT\ HDMI-NDI\ 001\ \(\#00\ \(A405200518097\)\)"
url-address = 198.18.1.98:5961
gst-launch-1.0 ndisrc ndi-name="PRO-CONVERT\ HDMI-NDI\ 001\ \(\#00\ \(A405200518097\)\)" url-address=198.18.1.98:5961 ! ...
Device found:
name : UBUNTU (2110_Transcoder_01)
class : Source/Audio/Video/Network
caps : application/x-ndi
properties:
ndi-name = "UBUNTU\ \(2110_Transcoder_01\)"
url-address = 198.18.1.94:5961
gst-launch-1.0 ndisrc ndi-name="UBUNTU\ \(2110_Transcoder_01\)" url-address=198.18.1.94:5961 ! ...
Device found:
name : PRO-CONVERT HDMI-NDI 002 (#00 (A405200518100))
class : Source/Audio/Video/Network
caps : application/x-ndi
properties:
ndi-name = "PRO-CONVERT\ HDMI-NDI\ 002\ \(\#00\ \(A405200518100\)\)"
url-address = 198.18.1.53:5961
gst-launch-1.0 ndisrc ndi-name="PRO-CONVERT\ HDMI-NDI\ 002\ \(\#00\ \(A405200518100\)\)" url-address=198.18.1.53:5961 ! ...
When I execute the command using the filter:
gst-device-monitor-1.0 -f Source/Network:application/x-ndi | awk '/name :/ {$1=$2=""; print$0}'
It results in the filtered output:
PRO-CONVERT HDMI-NDI 001 (#00 (A405200518097))
PRO-CONVERT HDMI-NDI 002 (#00 (A405200518100))
UBUNTU (2110_Transcoder_01)
But trying to read it into an array with filter applied:
readarray -t sources < <(gst-device-monitor-1.0 -f Source/Network:application/x-ndi | awk '/name :/ {$1=$2=""; print$0}')
And then reading the array using:
declare -p sources
or
echo ${sources[@]}
Results in nothing. Reading the array using the command without the filter applied gives the array of all values. So everything seems to work, except when the filter is applied?
gst-device-monitor-1.0program, but I copied your output to a file and usedcat gstoutput.txtinstead. It worked fine.readarray -t sources < <(cat gstoutput.txt | awk '/name :/ {$1=$2=""; print$0}')?