You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
335 B
Bash

#!/bin/sh
# Print a list of categories from all files
categories=()
read -a files <<< $(ls txt)
for file in "${files[@]}"
do
IFS=, read -a array <<< $(head -n 1 "txt/$file")
categories+=("${array[@]}")
done
IFS=" " read -r -a categories <<< "$(tr ' ' '\n' <<< ${categories[@]} | sort -u | tr '\n' ' ')"
echo "${categories[@]}"