Files
interactive/gms/LG/new_sh_statusd/test/extract_ip_domain.c
T
2026-08-07 17:38:18 +09:00

38 lines
715 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
FILE *ifp = NULL;
FILE *ofp1, *ofp2;
char one_line_str[2048];
char temp_str[8][512];
ifp = fopen("sms_data.txt", "r");
ofp1 = fopen("ip_list.txt", "w");
ofp2 = fopen("host_list.txt", "w");
while ( fgets(one_line_str, 2048, ifp) != NULL )
{
sscanf(one_line_str, "%s%s%s%s%s%s%s%s"
, temp_str[0]
, temp_str[1]
, temp_str[2]
, temp_str[3]
, temp_str[4]
, temp_str[5]
, temp_str[6]
, temp_str[7]);
fprintf(stdout, "%s %s\n", temp_str[3], temp_str[7]);
fprintf(ofp1, "%s\n", temp_str[3]);
fprintf(ofp2, "%s\n", temp_str[7]);
}
fclose(ifp);
fclose(ofp1);
fclose(ofp2);
return 0;
}