Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -euo pipefail
- file=${1:-./list.txt}
- col=$(cat -- "$file" | head -1 | awk -F, '$0=NF')
- f=$(mktemp)
- trap 'rm -f "$f"' EXIT
- for ((i = 1; i <= col; ++i)); do
- cat -- "$file" | cut -d, -f$i | sort -t, -u >"$f"
- if (($(wc -l <"$f") > 1)); then continue; fi
- # do something
- n=$(grep -Po '\d+' <"$f")
- echo $i "$n"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement