gpt4 book ai didi

awk:超出程序限制:最大字段数 size=32767

转载 作者:行者123 更新时间:2023-12-04 22:12:41 27 4
gpt4 key购买 nike

当我在 ubuntu 14.04 中运行我的 shell 脚本时,我收到如下错误

awk: program limit exceeded: maximum number of fields size=32767
FILENAME="ensemble_features/Training_BOOKS_POS_Bigram_with_stemming_BOOLEAN_FVT.csv" FNR=1 NR=1
cut: invalid byte, character or field list
Try 'cut --help' for more information.
-1
cut: invalid byte, character or field list
Try 'cut --help' for more information.
6656
user@user-Lenovo-IdeaPad-Z410:~/Thesis/BOOKS$ bash Training_POS_Uni_Bi.sh
awk: program limit exceeded: maximum number of fields size=32767
FILENAME="ensemble_features/Training_BOOKS_POS_Bigram_with_stemming_BOOLEAN_FVT.csv" FNR=1 NR=1
cut: invalid byte, character or field list
Try 'cut --help' for more information.
-1
cut: invalid byte, character or field list
Try 'cut --help' for more information.
6656

我在下面添加我的脚本
cd /home/user/Thesis/BOOKS/Features/Training/POSITIVE/
fname="ensemble_features"
mkdir $fname

cp /home/user/Thesis/BOOKS/Features/Training/POSITIVE/Training_BOOKS_POS_unigram_FVT_with_stemming_BOOLEAN.csv ensemble_features/
cp /home/user/Thesis/BOOKS/Features/Training/POSITIVE/Training_BOOKS_POS_Bigram_with_stemming_BOOLEAN_FVT.csv ensemble_features/


mkdir "proces"
cnt=0
for file in $fname/*
do
#Number of columns
num=`awk 'BEGIN {FS=",";c=0};{if (c==0 ){print NF; c=1}}END{}' $file`
if [[ cnt -eq 0 ]];then
cut -d, -f $num $file >class.csv
cnt=1;
fi
num=$((num-1))
echo $num
nfname=`basename $file`

#Cut the columns
cut -d',' -f1-$num $file > proces/cutlast$nfname
done
#Paste multiple csv
paste -d',' proces/* > comb.csv
paste -d, comb.csv class.csv > Training_BOOKS_Unigram_Bigram_POS_Ensemble_Features_BOOLEAN.csv
rm comb.csv
rm class.csv
rm -r proces
rm -r ensemble_features

我的输入文件分别包含 38453 列和 6656 列。有人可以帮我纠正这个错误吗?

最佳答案

在 ubuntu 上,awk 是一些 awk 变体的软链接(soft link),现在默认情况下它是 mawk。尝试安装 gawk。 gawk 对记录中的字段数没有限制。

顺便说一句,python 可能是一个更好的长期解决方案,如果你有时间学习它。

关于awk:超出程序限制:最大字段数 size=32767,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24292787/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com