Files
learngo/27-functional-programming/log-parser-exp/Makefile

29 lines
487 B
Makefile
Raw Normal View History

2019-08-08 14:11:54 +03:00
SHELL := /bin/bash
2019-08-08 17:19:20 +03:00
LINES = $$(wc -l log.txt | cut -f1 -d' ')
ECHO_LINES = echo -e ">> log.txt has $(LINES) lines"
2019-08-08 14:11:54 +03:00
2019-08-08 17:19:20 +03:00
s:
2019-08-08 14:11:54 +03:00
time go run . < log.txt
2019-08-08 17:19:20 +03:00
r:
2019-08-08 14:11:54 +03:00
go run . < log.txt
2019-08-08 17:19:20 +03:00
n ?= 18
2019-08-08 14:11:54 +03:00
load: restore
2019-08-08 17:19:20 +03:00
@echo "enlarging the file with itself, please wait..."
2019-08-08 14:11:54 +03:00
2019-08-08 17:19:20 +03:00
@for i in {1..$(n)}; do \
awk 1 log.txt log.txt > log_.txt; \
mv log_.txt log.txt; \
rm -f log_.txt; \
done
2019-08-08 14:11:54 +03:00
2019-08-08 17:19:20 +03:00
@$(ECHO_LINES)
restore:
@echo "restoring the file..."
@git checkout log.txt
@$(ECHO_LINES)
2019-08-08 14:11:54 +03:00
lines:
2019-08-08 17:19:20 +03:00
@$(ECHO_LINES)