Ways to remove a DOS end character

Source: Internet
Author: User
Sometimes we need to remove the end of DOS, then we can refer to the following method

DOS End character: CRLF Carriage-return line-feed

# Check to see if the file contains CRLF
1. File Dosfile
Back to CRLF

2. Cat-a Dosfile
Back 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 "RN" "N" dosfile
Tr-d "R" Dosfile

6. Cat Dosfile | Perl-pe ' ~s//r//g '

Merge files with the dos Copy command (How to eliminate the end of the 1A Terminator).

Recently the company Tenfore Feedhandler project to store a large number of rawdata files. Because the tenforerawdata is very large, the storage policy is to store one RawData file per hour. But when you perform data analysis playback, you want to combine them into a large file. In the beginning is to look for a third-party merging tool on the Internet, after a thought, dos Copy command is not can merge files? Try it now!
For example, you want to combine A.dat and b.dat into C.dat. Among them, the contents of A.dat binary are as follows "30 78 30 33 30 78 30 34", and the contents of the B.dat binary content are as follows, written a DOS script merge.bat, which reads as follows: "Copy a.dat+b.dat C . Dat ".
However, the newly generated c.dat file has the last Terminator "1 A", and the contents of the C.dat file are as follows "1 a".
After the internet to look up the reason, because the copy command by default is the target file and source files are treated as text files, so the newly generated file with the text Terminator "1 a".
The solution is simple, that is, when copying a copy of the binary file.
The new batch process reads as follows: "copy/b a.dat+b.dat c.dat"

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.