当前位置:网站首页>internal field separator
internal field separator
2022-07-01 22:46:00 【Yunmengtan】
Internal field separator (Internal Field Separator,IFS) yes shell An important concept in scripting . When processing text data , Often used .IFS In essence, it is a variable that holds the delimiter .
for instance , There is one CSV file , If you want to extract words , have access to IFS=" "; If you want to extract comma separated field values , You can use IFS="," .
extract CSV Fields in :
#!/bin/bash
data="Fist name, Last name, gender, rollno, location"
oldIFS=${IFS}
IFS=,
for item in ${data};
do
echo "Item : ${item}"
done
IFS=${oldIFS}
The operation results are as follows :
If you put IFS=, One line removed . So the default IFS Will be blank characters . The run result will change to :
边栏推荐
猜你喜欢
随机推荐
QStringList 的常规使用
Redis configuration and optimization
redis配置文件中常用配置详解[通俗易懂]
SAP GUI 里的收藏夹事务码管理工具
MySQL之MHA高可用配置及故障切换
Wechat open platform scanning code login [easy to understand]
Dark horse programmer - software testing - stage 06 2-linux and database-01-08 Chapter 1 - description of the content of the Linux operating system stage, description of the basic format and common fo
Understanding of inverted residuals
固定资产管理子系统报表分为什么大类,包括哪些科目
Redis配置与优化
【目标跟踪】|单目标跟踪指标
利用SecureCRTPortable远程连接虚拟机
【图像分割】2021-SegFormer NeurIPS
微信开放平台扫码登录[通俗易懂]
并发编程系列之FutureTask源码学习笔记
Pytorch sharpening chapter | argmax and argmin functions
【QT小作】封装一个简单的线程管理类
完全注解的ssm框架搭建
Kubernetes创建Service访问Pod
The fixed assets management subsystem reports are divided into what categories and which accounts are included