In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to read multiple files at the same time under shell". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to read multiple files at the same time under shell".
1. Reading of a single file
Under the shell script, you can read files by line in a variety of ways, as follows:
For line in `cat ${input_filename} `do echo $linedonewhile read linedo echo $linedone
< ${input_filename} 其中第二种方式是将文件重定向到标准输入中 2. 多个文件读取方法 那如何实现同时多个文件的读呢? 我们可以继续利用bash中的文件重定向功能,将文件重定向到特定的文件描述符中,语法如下: nfilen>> filenfile
The n here represents the file descriptor of the open file file, similar to fd in other programming languages. If n is not specified, the default behavior is as follows:
Filefile # same as 0file
We can use the exec command to open the file we want to redirect:
Exec 7
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.