Artificial intelligent assistant

writing of user's input with loop into text file echo -n "##### STATIONS? #######" read station awk -v input="$station" ' BEGIN { n = split(tolower(input), user) fmt = "%-4s\n" } {print} /stab_site clear/ { for (i=1; i<=n; i++) printf fmt, "stab_site" user[i] exit } ' ./data > data_2 Let assume user's input: `ankr ista` for stations. After the execution of codes, in data file, after the "`stab_site clear`" line, user's input is written as follows; stab_siteankr stab_siteista I need to give one space between "stab_site" and "station_ids" in the codes. I also need to write the lines after one space from the beginning of the line as follow; stab_site ankr stab_site ista

let split


printf fmt, "stab_site" user[i]


* `"stab_site" user[i]` will make `stab_sitenakr` as there is no space after site
* `printf fmt, "stab_site" user[i]` is turn to
* `print "%-4s\
" , stab_sitenakr` which print left aligned `stab_sitenakr`



maybe you are looking for


printf fmt, "stab_site " user[i]


or (as per OP's request)


printf " %s %s\
", "stab_site", user[i]

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 17cf82e8195934e96ad18ae23ed6c40d