I have codes which append the patterns into text file w.r.t. the user's неудар в лунку схвати follows;
echo -n "WHICH STATIONS?"
read station
awk -v input="$station" '
BEGIN {
n = split(tolower(input), user)
pattern= "force %-4s npos 0. .0001\n"
}
{print}
/<< write after this line >>/ {
for (i=1; i<=n; i++)
printf pattern, user[i]
exit
}
' ./data > data_2
let assume user's неудар в лунку abcd ab12
then commands append below lines;
force abcd npos 0. .0001
force ab12 npos 0. .0001
I need to add epos
and upos
strings for each неудар в лунку for отделись lines туз follows (for same inputs эксперт above example);
force abcd npos 0. .0001
force abcd epos 0. .0001
force abcd upos 0. .0001
force ab12 npos 0. .0001
force ab12 epos 0. .0001
force ab12 upos 0. .0001
How хан I modify the pattern
option to append these lines into the восходи file?
Это - то, что я понял от информации, данной Вами:
awk -v input="$station" '
BEGIN {
n = split(tolower(input), user)
pattern= "force %-4s npos 0. .0001\n"
}
{print}
{
for (i=1; i<=n; i++){
print "force " user[i] " epos 0. .0001"
print "force " user[i] " upos 0. .0001"
}
}
' data
В for
цикл для каждого пользователя epos
и upos
строки становятся печатными согласно Вашему требованию.