当前位置:网站首页>Awk from introduction to earth (16) discussion on the types of awk variables -- about the two types of numbers and strings
Awk from introduction to earth (16) discussion on the types of awk variables -- about the two types of numbers and strings
2022-07-28 07:53:00 【Wonderful binary】
awk( Variable 、 Array elements and fields ) The scalar object in is Dynamic type Of . This means that their types can change as the program runs , From no type before use , To string or number , Then from string to number or from number to string , As the program goes .
You can't do many things with untyped variables , Except to tell them that they are untyped . The following procedure is for a To test ; When a When never assigned , Test success . It also uses built-in typeof() Function to display a The type of :
$ gawk 'BEGIN { print (a == "" && a == 0 ?
> "a is untyped" : "a has a type!") ; print typeof(a) }'
a is untyped
unassigned
Similarly , When assigning a string value to a scalar , Scalars have string types , For example, from a string constant or from another scalar with a string type :
gawk 'BEGIN { a = 42 ; print typeof(a) ;b = a ; print typeof(b) }'
up to now , All this is simple and clear . however , When awk What happens when processing data from users ? Let's start with the field data . What should the following command produce as output ?
echo hello | awk '{ printf("%s %s < 42\n", $1,
($1 < 42 ? "is" : "is not")) }'
because ’hello’ Is alphabetic data ,awk Only string comparison . In the internal
边栏推荐
- Merge two sorted linked lists - two questions per day
- Summary of RFID radiation test
- Industry standards and certification of common electronic products
- 【着色器实现Negative反色效果_Shader效果第十一篇】
- Don't be afraid of ESD static electricity. This article tells you some solutions
- Big talk persistence and redolog
- [untitled]
- PCB design skills of EMC
- MySQL basic knowledge learning (II)
- 再次出现用户净流失,大失颜面的中国移动推出超低价套餐争取用户
猜你喜欢

flowable工作流所有业务概念
![[solution] visual full link log tracking - log tracking system](/img/0c/f93c7d31e01257c5dee7d292ac7d84.jpg)
[solution] visual full link log tracking - log tracking system

Discrimination coverage index / index coverage / Samsung index

DNA modified osmium OS nanoparticles osnps DNA modified iridium nanoparticles irnps DNA

使用FFmpeg来批量生成单图+单音频的一图流视频

DNA modified rhodium RH nanoparticles rhnps DNA (DNA modified noble metal nanoparticles)

干货|分享一个EMC实际案例及整改过程

整改了七次,花了半个月时间,惨痛的EMC总结

CAS vs Database optimistic lock

DNA-CuInSeQDs近红外CuInSe量子点包裹脱氧核糖核酸DNA
随机推荐
Collector原理解析
ArcGIS JS customizes the accessor and uses the watchutils related method to view the attribute
Guava cache of guava
leetcode 字符串类
解析树形结构 js
SWM32系列教程5-ADC应用
On deep paging
Niuke MySQL - SQL must know and know
【花书笔记】 之 Chapter01 引言
DNA modified osmium OS nanoparticles osnps DNA modified iridium nanoparticles irnps DNA
ArcGIS JS自定义Accessor,并通过watchUtils相关方法watch属性
Merge two sorted linked lists - two questions per day
Method of hiding scroll bar in wechat applet
And is two numbers of S - two questions per day
DNA脱氧核糖核酸修饰金属铂纳米颗粒PtNPS-DNA|科研试剂
mysql,可以使用多少列创建索引?
Learn software testing in two weeks? I was shocked!
awk从入门到入土(16)awk变量类型探讨--关于数字和string两种类型
Cdn.jsdelivr.net is not available, what should I do
How to understand the adjective prefix of socket: "connection oriented" and "connectionless"