In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to delete the DOS Terminator, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
DOS Terminator: CRLF Carriage-Return Line-Feed
# check whether the file contains CRLF
1. File dosfile
Return to CRLF
2. Cat-a dosfile
Return to ^ M
# Delete CRLF
1. Vim
: set fileformat=unix #: set ff=unix
: w
: s / ^ M / / gc # Linux: Ctrl+V+M Enter, AIX: Ctrl+V Ctrl+ ^ Enter
: w
2. Dos2uninx dosfile
3. Col-bx dosfile
4. Sed-e's / ^ M / / 'dosfile
5. Tr
Tr-s "\ r\ n"\ n" dosfile
Tr-d "\ r" dosfile
6. Cat dosfile | perl-pe'~ RAMG'
Use dos's copy command to merge files (how to eliminate the ending 1A Terminator).
Recently, the company's Tenfore FeedHandler project split has stored a large number of RawData files. Because the TenforeRawData is very large, the storage strategy is to store one rawdata file every hour. However, when performing data analysis and playback, we want to merge them into one large file. At first, I thought of finding a third-party merge tool on the Internet, but on second thought, can't dos's copy command merge files? Try it now!
For example, you want to merge a.dat and b.dat into c.dat. Among them, the a.dat binary content is as follows: "3078 30 31 30 30 30 32", the b.dat binary content is as follows "30 78 30 33 30 78 30 34", wrote a dos script merge.bat, the content is as follows: "copy a.dat+b.dat c.dat".
However, the newly generated c.dat file ends with a Terminator "1A", and the content of the c.dat file is as follows: "30 78 30 31 30 78 30 32 30 78 33 30 78 30 34 1A".
Later, I went online to find the reason, because the copy command defaults to treat both the target file and the source file as text files, so the newly generated file has a text Terminator "1A".
The solution is simple: specify that you are copying binaries when you copy.
The new batch is as follows: "copy / b a.dat+b.dat c.dat"
Thank you for reading this article carefully. I hope the article "how to delete the DOS Terminator" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.