diff --git a/AWK.txt b/AWK.txt new file mode 100644 index 0000000..6f3e0db --- /dev/null +++ b/AWK.txt @@ -0,0 +1,37 @@ +AWK + + * searches files for lines that contain certain pattern + * performs operation described in AWK body on line with certain + pattern. + * performs operation described in AWK body on choosen line + + + * Basic structure + + awk 'program_you_will_write' input-file1 input-file2 + + awk 'BEGIN{ + code_in_BEGIN_section + } + + { code_in_main_body_section } + + END{ + code_in_END_section + }' input-file1 input-file2 + + * AWK Commands + + * In AWK body bash features doesn't work + * Completely new language in AWK body + * print + * if-else + * for loop + * ... + + * Completely new features we can call on specific line (specific text) + * NF (number of fields) + * NR (number of records) + * RS (records separator) + * $1,$2,.. (specific fields) + * ... \ No newline at end of file diff --git a/Makefile1 b/Makefile1 new file mode 100644 index 0000000..b179454 --- /dev/null +++ b/Makefile1 @@ -0,0 +1,57 @@ +SOLUTION_BINARY = solution +BRUTEFORCE_BINARY = $(notdir Stress_Testing/bruteForce) +GENERATOR_BINARY = $(notdir Stress_Testing/generator) +CODEDIRS = . ./Stress_Testing +INCDIRS = . + +BUILD_DIR = build +OBJS_DIR = $(BUILD_DIR)/objs + +CXX = g++ +DEPFLAGS = -MP -MMD +CXXFLAGS = -Wall -Wextra -g \ + $(foreach D,$(INCDIRS), -I$(D)) \ + $(DEPFLAGS) + +CXXFILES = $(foreach D, \ + $(CODEDIRS), \ + $(wildcard $(D)/*.cpp)) + +OBJECTS = $(patsubst %.cpp, $(OBJS_DIR)/%.o, $(notdir $(CXXFILES))) +DEPFILES = $(patsubst %.cpp, $(OBJS_DIR)/%.d, $(notdir $(CXXFILES))) + +all: $(BUILD_DIR)/$(SOLUTION_BINARY) \ + $(BUILD_DIR)/$(GENERATOR_BINARY) \ + $(BUILD_DIR)/$(BRUTEFORCE_BINARY) + +$(BUILD_DIR)/$(SOLUTION_BINARY): $(OBJS_DIR)/$(SOLUTION_BINARY).o + $(CXX) -o $@ $< + +$(BUILD_DIR)/$(GENERATOR_BINARY): $(OBJS_DIR)/$(GENERATOR_BINARY).o + $(CXX) -o $@ $< + +$(BUILD_DIR)/$(BRUTEFORCE_BINARY): $(OBJS_DIR)/$(BRUTEFORCE_BINARY).o + $(CXX) -o $@ $< + + +$(OBJS_DIR)/%.o: %.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +$(OBJS_DIR)/%.o: Stress_Testing/%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +clean: + rm -rf $(BUILD_DIR)/$(SOLUTION_BINARY) \ + $(BUILD_DIR)/$(BRUTEFORCE_BINARY) \ + $(BUILD_DIR)/$(GENERATOR_BINARY) \ + $(OBJECTS) \ + $(DEPFILES) + +help: + @echo "make clean: To remove executable, objects and dependency files." + @echo "make $(SOLUTION_BINARY): To build $(SOLUTION_BINARY) only." + @echo "make all: To build for Stress_Testing." + +-include $(DEPFILES) + +.PHONY: clean help all