Stack Exchange
Bash - Insert to Column 1
Insert the value of SysName="*" in the same line as the first column
Inventory:
$ cat testinv
Device_Classification="Systems" device_role="web server" SysName="Server1" MachineType="Windows 2019 Server" Environment="PROD" Application_name="Solarwinds"
Device_Classification="Systems" device_role="App Server" SysName="Server2" MachineType="RHEL 8" Environment="PROD" Application_name="Solarwinds"
Device_Classification="Systems" device_role="App Server" SysName="Server3" MachineType="RHEL 7" Environment="PROD" Application_name="Solarwinds"

*New Value should look like this:
Server1 Device_Classification="Systems" device_role="web server" SysName="Server1" MachineType="Windows 2019 Server" Environment="PROD" Application_name="Solarwinds"
Server2 Device_Classification="Systems" device_role="App Server" SysName="Server2" MachineType="RHEL 8" Environment="PROD" Application_name="Solarwinds"
Server3 Device_Classification="Systems" device_role="App Server" SysName="Server3" MachineType="RHEL 7" Environment="PROD" Application_name="Solarwinds"*

Code:
$ cat bashscript_INV.sh
#!/bin/bash

sed '/results/d; /\[/d ; /\]/d; /{/d ; /}/d' toprocess_asINV | xargs  -n 12 | sed 's/:/=/g; s/= /="/g; s/,/"/g; s/$/"/g' | grep -oh SysName=".*" | awk {'print $1'} | sed 's/SysName="//g; s/"//g' | tee testinv

New Value should look like this:
Server1 Device_Classification="Systems" device_role="web server" SysName="Server1" MachineType="Windows 2019 Server" Environment="PROD" Application_name="Solarwinds"
Server2 Device_Classification="Systems" device_role="App Server" SysName="Server2" MachineType="RHEL 8" Environment="PROD" Application_name="Solarwinds"
Server3 Device_Classification="Systems" device_role="App Server" SysName="Server3" MachineType="RHEL 7" Environment="PROD" Application_name="Solarwinds"


It seems you forgot to include a question in your question.

Would sed 's/.* SysName="\([^"]*\)".*/\1 &/g' do?

It would make sense to specify, what characers are allowed inside the sysname. Or is it always Server, followed by a number?

What is your question? How to fix your code (and, if so, what problem does it have)? How to make your code more efficient? How to make it more concise? Something else?

The first thing your script does is sed '/results/ but there's no results in the sample input you provided. Ditto for various other things your script does - they don't make sense with respect to the sample input you provided. Please post a [mcve].

Once you decide to use awk for (part of) your solution you can typically eliminate the use of sed and grep.
Assuming the Sysname="Server#" shows up in the exact same location in each line:
awk -F'"' '                              # input field delimiter is double quote
{ print $6,$0 }                          # print 6th field followed by entire line
' testinv

If the Sysname="Server#" could show up anywhere in the line:
 awk -F'"' '                            # input field delimiter is double quote
 { for (i=1;i<=NF;i+=2)                 # loop through odd numbered fields
       if ($i ~ /SysName=/) {           # if ith field includes string "SysName=" then ...
          print $(i+1),$0               # print (i+1)th field followed by entire line
          next                          # skip to next line of input
       }
 }
 ' testinv

These both generate:
Server1 Device_Classification="Systems" device_role="web server" SysName="Server1" MachineType="Windows 2019 Server" Environment="PROD" Application_name="Solarwinds"
Server2 Device_Classification="Systems" device_role="App Server" SysName="Server2" MachineType="RHEL 8" Environment="PROD" Application_name="Solarwinds"
Server3 Device_Classification="Systems" device_role="App Server" SysName="Server3" MachineType="RHEL 7" Environment="PROD" Application_name="Solarwinds"


You can use grep with some short regex and paste.
# FILE_NAME="testinv"

paste <(grep -Po 'SysName=\"\K\w+' ${FILE_NAME}) ${FILE_NAME}

result:
Server1 Device_Classification="Systems" device_role="web server" SysName="Server1" MachineType="Windows 2019 Server" Environment="PROD" Application_name="Solarwinds"
Server2 Device_Classification="Systems" device_role="App Server" SysName="Server2" MachineType="RHEL 8" Environment="PROD" Application_name="Solarwinds"
Server3 Device_Classification="Systems" device_role="App Server" SysName="Server3" MachineType="RHEL 7" Environment="PROD" Application_name="Solarwinds"


explanation:

paste : do something like "merging columns"; so use this command to "paste" matched result as first column.
grep -Po : grep with Perl-regex, and return only matching part.
\K : short for positive lookbehind in regex. see [1][2]. This means only match those \w+ right after the SysName=\"
<( ... ) : take inner command result as parameter. see: [3]


REF:

https://stackoverflow.com/a/2341206
https://stackoverflow.com/a/33573989
https://www.gnu.org/software/bash/manual/bash.html#Process-Substitution

