4.3BSD-UWisc/lib/learn/C/L16.2b

#print
Write a program which copies all lines containng
the letter 'p' from its input to its output.
Compile and test it; then type "ready".
#once #create Ref
mountain station south orange maplewood millburn short hills
new providence murray hill berkeley heights
bernardsville far hills peapack gladstone
#once #create badin
hoboken harrison newark roseville avenue grove street
east orange brick church orange highland avenue
mountain station south orange maplewood millburn short hills
summit chatham madison convent station morristown
new providence murray hill berkeley heights
gillette stirling millington lyons basking ridge
bernardsville far hills peapack gladstone
#once cp %s/getline.o .
#user
a.out <badin >xxx
#cmp Ref xxx
#succeed
/*	a way to find lines with 'p' */
 #include <stdio.h>

main()
{
	char line[500];
	int k;

	while (getline(line, 500) > 0)
		for (k = 0; line[k] != '\0'; k++)
			if (line[k] == 'p') {
				printf("%s", line);
				break;
			}
}
#log
#next
16.2c 5
17.1a 10