Artificial intelligent assistant

How can I add a string to the first field of the output with awk? The following script prints the output down: /var/lib/ambari-server/resources/scripts/configs.sh get localhost c1 yarn-env The output of the script: "yarn_log_dir_prefix" : "/var/log/hadoop-yarn", "yarn_pid_dir_prefix" : "/var/run/hadoop-yarn", "yarn_user" : "yarn", "yarn_user_nofile_limit" : "32768", "yarn_user_nproc_limit" : "65536" I want to add with pipeline the awk or perl oneline linear, the **yarn-env** in the first field of output as the following: (expected results) /var/lib/ambari-server/resources/scripts/configs.sh get localhost c1 yarn-env | awk ... yarn-env "yarn_log_dir_prefix" : "/var/log/hadoop-yarn", yarn-env "yarn_pid_dir_prefix" : "/var/run/hadoop-yarn", yarn-env "yarn_user" : "yarn", yarn-env "yarn_user_nofile_limit" : "32768", yarn-env "yarn_user_nproc_limit" : "65536"

/var/lib/ambari-server/resources/scripts/configs.sh get localhost c1 yarn-env |
awk '{ print "yarn-env", $0 }'


This short `awk` script will prepend the string `yarn-env` to each line of input from your command. The delimiter used is the `awk` variable `OFS` ("output field separator", a single space by default), so if you want a tab between the two, use


/var/lib/ambari-server/resources/scripts/configs.sh get localhost c1 yarn-env |
awk -vOFS="\t" '{ print "yarn-env", $0 }'


Alternatively, using `sed`:


/var/lib/ambari-server/resources/scripts/configs.sh get localhost c1 yarn-env |
sed 's/^/yarn-env /'

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a11caf96fc8611a273947c08e31110e3