package p24_pliki;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;

public class PonumerujTadeusza {
	public static void main(String[] args) {
		try(Scanner scanner = new Scanner(new File("pliki/pan_tadeusz.txt"));
			PrintWriter out = new PrintWriter("out/ponumerowane.txt")) {
				int nr = 0;
				while(scanner.hasNextLine()) {
					String line = scanner.nextLine().strip();
					if(!line.isEmpty()) {
						out.printf("%6d: %s%n", ++nr, line);
					}
				}
				System.out.printf("Zapisano %d linii.%n", nr);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

}
