当前位置:网站首页>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
边栏推荐
- 打新债注册账户安全吗,会有风险吗?
- #796 Div.2 F. Sanae and Giant Robot set *
- Which securities speculation account opening commission is the cheapest and safest
- Flutter SliverAppBar全解析,你要的效果都在这了!
- LabVIEW连续采样与有限采样模式
- Why stainless steel swivel
- Alchemy (2): why use issue management software
- 【MySQL】-【函数】
- Is it safe to open a new bond registration account? Is there any risk?
- 哪个证券公司炒股开户是比较好,更安全靠谱的
猜你喜欢

什么是过孔式导电滑环?

Taro---day2---编译运行

Overview and deployment of GFS distributed file system

【无标题】

electron窗口背景透明无边框(可用于启动页面)
![完全二叉树的节点个数[非O(n)求法 -> 抽象二分]](/img/56/768f8be9f70bf751f176e40cbb1df2.png)
完全二叉树的节点个数[非O(n)求法 -> 抽象二分]

去哪儿网(Qunar) DevOps 实践分享

Arduino uno realizes simple touch switch through direct detection of capacitance

What is promise

Alchemy (1): identify prototype, demo and MVP in project development
随机推荐
Function and usage of malloc function in C language
章凡:飞猪基于因果推断技术的广告投后归因
How to add live chat in your Shopify store?
吸顶方案1
Ten MySQL locks, one article will give you full analysis
Alchemy (2): why use issue management software
Squid proxy server (Web cache layer for cache acceleration)
DeepMind | 通过去噪来进行分子性质预测的预训练
#796 Div.2 C. Manipulating History 思维
Distortion model of SDF learning
網頁鼠標點擊特效案例收集(直播間紅心同理)
手机股票开户安全吗,买股票在哪开户?
Summary of wuenda's machine learning course (14)_ Dimensionality reduction
投资场内ETF基金是靠谱吗,场内ETF基金安全吗
Introduction to memory model of JVM
Arduino uno realizes simple touch switch through direct detection of capacitance
Proe/creo product structure design - continuous research
Sword finger offer 61 Shunzi in playing cards
[Reading Abstract] what is wrong with English Reading Teaching in schools-- Empiricism and the PK of cognitive science
Is it safe to open a new bond registration account? Is there any risk?