当前位置:网站首页>Some problems in awk
Some problems in awk
2022-06-28 01:20:00 【Lime Town in the sun】
1、 Write a bash Script to count a text file ceshi.txt The number of occurrences of each word in
awk '{i=1;while(i<=NF){a[$i]++;i++}}END{for(x in a){print x,a[x]}}' ceshi.txt | sort -nk 2
*** Be careful :*** To separate fields in a row
The following line is directly used as the processing unit , It's wrong.
awk '{a[$i]++}END{for(j in a){print a[j],j}}' ceshi.txt | sort -nk 1
2、 When the text is not followed , Pay attention to BEGIN
3、 Write a bash Script to count a text file nowcoder.txt The number of letters in is less than 8 's words
It's easier to use scripts directly
#! /bin/bash
string=$(cat aa.txt)
for i in $string
do
if [ ${
#i} -lt 8 ];then
echo $i
fi
done
among
${#i}
Statistics string i Characters of
4、 Write a bash Script to remove a text file nowcoder.txt Empty line in
awk '!/^$/{print $0}' nowcoder.txt
边栏推荐
- Matlb| optimal configuration of microgrid in distribution system based on complex network
- .mp4视频测试地址
- 哪个证券炒股开户佣金是最便宜,最安全的
- #795 Div.2 D. Max GEQ Sum 单调栈
- 网页鼠标点击特效案例收集(直播间红心同理)
- Message Oriented Middleware for girlfriends
- Lodash realizes anti shake and throttling functions and native implementation
- lefse分析本地实现方法带全部安装文件和所有细节,保证成功。
- 剑指 Offer 65. 不用加减乘除做加法
- 【MySQL】-【函数】
猜你喜欢
GFS 分布式文件系统概述与部署
Arduino uno realizes simple touch switch through direct detection of capacitance
Introduction to memory model of JVM
Meituan dynamic thread pool practice idea has been open source
Deep parsing of kubernetes controller runtime
剑指 Offer 61. 扑克牌中的顺子
What is the e-commerce conversion rate so abstract?
What are cookies and the security risks of v-htm
FB、WhatsApp群发消息在2022年到底有多热门?
Mongodb- install a mongodb database locally on the windows computer
随机推荐
Alchemy (6): iteratable models and use cases
Summary of wuenda's machine learning course (14)_ Dimensionality reduction
Latest MySQL advanced SQL statement Encyclopedia
. Mp4 video test address
Is it safe to open an account online now? Novice is just on the road, ask for the answer
Mongodb- install a mongodb database locally on the windows computer
最新MySQL高级SQL语句大全
Flutter SliverAppBar全解析,你要的效果都在这了!
为什么要选择不锈钢旋转接头
Taro---day2---编译运行
手机股票开户安全吗,买股票在哪开户?
Which securities speculation account opening commission is the cheapest and safest
What is a better and safer app for securities companies to buy stocks
Acwing game 57 [unfinished]
How to add live chat in your Shopify store?
深入解析kubernetes controller-runtime
lefse分析本地实现方法带全部安装文件和所有细节,保证成功。
795 div.2 D. Max GEQ sum monotone stack
Taro--- day2--- compile and run
Class文件结构和字节码指令集