Следующее должно дублировать функцию вашего примера кода c:
#!/bin/awk -f
BEGIN{
printf("Enter the name of a text file: ")
getline file < "-"
printf("Enter the pattern to search for: ")
getline searchfor < "-"
print "File contents:"
while (getline < file){
# NR does not work for files read with getline in this way, so....
linenum++
printf("%5d) %s\n",linenum,$0)
if ($0 ~ searchfor){
matchcount++
matches=matches sprintf("There is a match on line %d\n",linenum)
}
}
print matches
printf("'%s' appeared %d times in file %s.\n",searchfor,matchcount,file)
}
После БОЛЬШИХ поисков я нашел решение изменить Subsystem sftp /usr/lib/openssh/sftp-server
на Subsystem sftp internal-sftp
в /etc/ssh/sshd_config
, и это, похоже, решило проблему.
В Arch НЕТ usr/lib/openssh/sftp-server
!