- 498 名前:名無しさん@お腹いっぱい。 mailto:sage [2021/11/03(水) 10:06:32.55 .net]
- $ time sh smf1.sh
real 0m4.088s user 0m2.324s sys 0m3.803s $ cat smf1.sh #!/bin/sh SMF=/tmp/xxx [ ! -x $SMF ] && { cc -x c - -o $SMF << 'EOS' #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { const size_t BUFFER_SIZE = 1024 * 1024 + 1; char *buffer = (char *)malloc(BUFFER_SIZE); while (fgets(buffer, BUFFER_SIZE, stdin) != NULL) { char *ep = buffer + strlen(buffer) - 1; if (ep >= buffer && *ep == '\n') *ep = '\0'; if (buffer[0] == '\0') putc('\n', stdout); else printf("%s ", buffer); } return 0; } EOS [ $? -ne 0 ] && exit 1; } $SMF < aaa | grep '\<1414213\>' | tr ' ' '\n'
|

|