我试图自动清理与我合作的各种单词表的过程。这是下面的代码:
#!/bin/bash
# Removes spaces and duplicates in a wordlist
echo "Please be in the same directory as wordlist!"
read -p "Enter Worldlist: " WORDLIST
RESULT=$( awk '{print length, $0}' $WORDLIST | sort -n | cut -d " " -f2- )
awk '!(count[$0]++)' $RESULT > better-$RESULT
这是运行程序后收到的错误:
./wordlist-cleaner.sh: fork: Cannot allocate memory
第一篇文章,希望我格式化正确。
awk '{print length, $0}' "$WORDLIST" | sort -n | cut -d " " -f2- | uniq > better-RESULT
请注意,它是better-RESULT
而不是better-$RESULT
,因为您不想将其用作文件名。