当前位置:网站首页>shell中awk命令的if条件语句引入外置变量
shell中awk命令的if条件语句引入外置变量
2022-08-02 17:33:00 【Direct_】
shell中awk命令的if条件语句引入外置变量
原文地址:https://www.cnblogs.com/liangxuran/p/14526396.html
shell脚本中常常用到awk的按列筛选功能,但是外部变量不能直接在awk中引用。正确引入方式是 ‘“$a”’ 即外部是一个单引号,内部是一个双引号。
awk中的IF语句需要注意以下几点:
对于数字文本可以使用 == >= <= != 代表等于大于小于不等于
对于文字文本可以使用 ~/text/ 代表含有
对于逻辑性文本 && || ! 代表且或非
对于内置变量,变量前不需要加 $ 符号,只需要字母即可
对于外置变量,变量前不仅要加 还需要引号括起 来 ′ " 还需要引号括起来 '" 还需要引号括起来′"{variable}"’
示例:


边栏推荐
- 攻防世界-favorite_number
- Kubernetes:(七)优化大法(江湖失传已久的武林秘籍)
- 每日优鲜倒了,叮咚买菜的春天在哪?
- Arduino hardware programming introduction to language learning
- 德国客户对文档管理系统、工作流自动化软件 DocuWare 的评价
- C语言中的一系列操作符
- What is the difference between erp system and wms system
- navicat creates a connection 2002-can't connect to server on localhost (10061) and the mysql service has started the problem
- 牛津硕士进碳圈,高瓴红杉经纬一起投了
- MySQL基本操作和基于MySQL基本操作的综合实例项目
猜你喜欢

小程序毕设作品之微信体育馆预约小程序毕业设计成品(7)中期检查报告

Continuous integration (4) Jenkins configuration alarm mechanism

Red and blue against experience sharing: CS from kill posture

Mysql开启binlog

租房小程序自动定位城市
![[C Language Brush Questions] Three Questions for Getting Started with Pointers | String Length, String Copy, Two Number Swap](/img/40/0bf9f887051954131b346ece0765d4.png)
[C Language Brush Questions] Three Questions for Getting Started with Pointers | String Length, String Copy, Two Number Swap

红队实战靶场ATT&CK(一)

Gear 月度更新|6 月

文件上传很难搞?10分钟带你学会阿里云OSS对象存储

cpolar应用实例之多设备数据采集
随机推荐
动力电池扩产潮,宁德时代遭围剿
9月起中国给予多哥等16国98%税目产品零关税待遇
golang源码分析(12)martini源码分析
NeRF:火爆科研圈的三维重建技术大揭秘
erp系统和wms系统有什么区别
navicat creates a connection 2002-can't connect to server on localhost (10061) and the mysql service has started the problem
2022安全员-C证考试题库模拟考试平台操作
What is an APS system?What should I pay attention to when importing APS?Worth watching again and again
嵌入式Qt-做一个秒表
蔚来杯2022牛客暑期多校训练营5 ABCDFGHK
LeetCode·每日一题·
一篇文章带你搞定BFC~
golang源码分析(2):Golang context 包
What is the difference between erp system and wms system
融云「 IM 进阶实战高手课」系列直播上线
解决多版本jar包冲突问题
使用lodash替换js字符串中的变量
Flink学习9:配置idea开发flink-Scala程序环境
土巴兔IPO五次折戟,互联网家装未解“中介”之痛
DeepMind 首席科学家 Oriol Vinyals 最新访谈:通用 AI 的未来是强交互式元学习