问题描述
您好,
我的数据看起来像是浮动的exepmles:
a; kkkhkhk; hgvhgvhgvh; 123; t
a; bbbg; yuj; 1237
x; 25; z; t
我想计算每一行中出现;(分号)的次数。并且,当给定字符的数量大于4时,它应该将相应的行存储到文件中。
我尝试过以下代码:
awk -F';''NF == 31'$ nom'_temp2.csv'> $ nom'_temp3.csv'
它在命令行上工作但不在crontab中工作。
等待解决方案。
提前谢谢你
我尝试过:
awk -F';''NF == 31'$ nom'_temp2.csv'> $ nom'_temp3.csv'
Hello ,
I have data that look like the floowing exepmles :
a ;kkkhkhk ;hgvhgvhgvh ;123 ;t
a ;bbbg ;yuj ;1237
x ;25 ;z ;t
I want to count the occurrences of ";"(semicolon) in every line. and, when the number of the given character is above 4, it should store the corresponding line into a file .
I have tried the code below :
awk -F ';' 'NF==31' $nom'_temp2.csv' > $nom'_temp3.csv'
it did work on command line but not in crontab.
Waiting for a solution.
Thanks you in advance
What I have tried:
awk -F ';' 'NF==31' $nom'_temp2.csv' > $nom'_temp3.csv'
推荐答案
这篇关于如何计算unix行中给定字符的出现次数(crontab)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!