Back (Current repo: scraps)

random scraps and notes that are useful to me
To clone this repository:
git clone https://git.viktor1993.net/scraps.git
Log | Download | Files | Refs

commit f18fea30044b46a8f7e6ff21c159c9829c4d5bd6
parent 1814824a2e55a2bd088c2040b9ac4edd7e36627e
Author: root <root>
Date:   Mon, 21 Apr 2025 16:16:38 +0200

add awk script

Diffstat:
Aawk/compare_single_columns.awk | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/awk/compare_single_columns.awk b/awk/compare_single_columns.awk @@ -0,0 +1,24 @@ +#!/usr/bin/awk +#USAGE: awk -f compare_single_columns.awk <file1> <file2> +BEGIN{ + print "Only in "ARGV[2]":"; +} +(NR==FNR) { + a[$0]++;next +} +{ + if($0 in a) { + a[$0]="-1" + } else { + print + } +} + +END{ + print "Only in "ARGV[1]":"; + for(x in a) { + if(a[x]!="-1") { + print x;} + + } +}