当前位置:网站首页>Shell reads files by line
Shell reads files by line
2022-06-11 03:01:00 【Ink mark vs. breeze】
background
Do batch file replacement 、 deleted , Read the file name written in the file content , Put in an array , Traversal for Cyclic batch replacement .
Writing a
#!/bin/bash
# describe :
# while Cyclic line reading operation
while read line
do
echo $line
done < filenameWrite two ( This loop loses data in the array after dynamically adding the array )
#!/bin/bash
# describe :
# cat Post read line operation
cat filename | while read line
do
echo $line
doneWrite three
#!/bin/bash
# describe :
# for Cyclic line reading operation , And while There is a difference between reading lines
for line in `cat filename`
do
echo $line
donenotes
for Cyclic line reading operation , And while The difference between reading lines
while Is to read completely by line , No matter how many paragraphs there are in the line
for Yes, read by line , If there are spaces in the text in the line , Read separately , That is, read one at a time character string
边栏推荐
猜你喜欢

How to handle error code 30204-44 when installing office 2016 in win10?

B_QuRT_User_Guide(17)

Manon's advanced road - Daily anecdotes

蓝桥杯_小蓝吃糖果_鸽巢原理 / 抽屉原理

If you understand the logic of mining and carbon neutrality, you will understand the 100 billion market of driverless mining areas

CocosCreator原生二次开发的正确姿势

新来的同事问我 where 1=1 是什么意思???

马志强:语音识别技术研究进展和应用落地分享丨RTC Dev Meetup

Arduino使用NRF24L01模块进行无线通信
![[resolved] how to fix another update in progress WordPress upgrade error](/img/b1/7b9945c1a623c20288f0d232cbb0c4.jpg)
[resolved] how to fix another update in progress WordPress upgrade error
随机推荐
Blue Bridge Cup_ Xiao Lan eats candy_ Pigeon nest principle / drawer principle
Help you distinguish GNU, GCC, GCC and G++
最长递增子序列
How to ensure reliable delivery of messages?
出栈序列是否是入栈序列
Application of the remote acquisition IOT gateway of the Bashir trough flowmeter in open channel flow monitoring
同一个用户的两次请求SessionId竟然不一致-----记录问题
TimeHelper
多值映射:ArrayListMultimap和HashMultimap
Android WiFi hide SSID configuration method
com. mchange. v2.c3p0. Combopooleddatasource red
怎样简洁明了地说清楚产品需求?
js 内存泄漏
msg=SolrCore ‘collection1‘ is not available due to init failure: Could not l
Error excluded identifier before '(' token, grpc enumeration class compilation error
重磅直播!ORB-SLAM3系列之特征匹配(MLPnP、词袋模型等)。
6 best WordPress Image optimizer plug-ins to improve WordPress website performance
Fuluo classic source code Fuluo classic system development principle sharing
Cypress 88359 WL command enable hotspot
CPT 102_ LEC 17