当前位置:网站首页>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 :

边栏推荐
猜你喜欢
随机推荐
Easyexcel complex data export
Redis配置与优化
There is no signal in HDMI in computer games caused by memory, so it crashes
LC501. 二叉搜索树中的众数
详解JMM
Niuke monthly race - logarithmic sum in groups
awoo‘s Favorite Problem(优先队列)
Object memory layout
Fiori 应用通过 Adaptation Project 的增强方式分享
详解Kubernetes网络模型
Learn MySQL from scratch - database and data table operations
对象内存布局
【扫盲】机器学习图像处理中的深层/浅层、局部/全局特征
Sonic cloud real machine learning summary 6 - 1.4.1 server and agent deployment
pytorch训练自己网络后可视化特征图谱的代码
How to write a performance test plan
Pytorch sharpening chapter | argmax and argmin functions
nn.Parameter】Pytorch特征融合自适应权重设置(可学习权重使用)
In the past 100 years, only 6 products have been approved, which is the "adjuvant" behind the vaccine competition
人体姿态估计的热图变成坐标点的两种方案









