In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use the dos2unix command, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
The os2unix command is used to convert text files in DOS format to UNIX format (DOS/MAC to UNIX text file format converter). The text file under DOS is marked with\ r\ nas a line breaker, which is 0D 0A in hexadecimal. The text file under Unix uses\ nas the line break flag, which is 0A in hexadecimal. Text files in DOS format are under Linux, and ^ M appears at the end of the line when opened with an earlier version of vi, and many commands do not handle this format very well, if it is a shell script. On the other hand, text files in Unix format will be displayed together when opened with Notepad under Windows. Therefore, there is a need to convert the two format files to each other, and the corresponding unix2dos command is to convert the UNIX format text file to DOS format.
1. Install dos2unix
Command: yum install-y dos2unix
Check to see if it is installed before installation:
[root@hadoop002 ~] # rpm-qa | grep-I dos2unix
[root@hadoop002 ~] #
If the instructions are not printed, they are not installed. Execute the command: yum install-y dos2unix to install.
Check again after the installation is complete:
[root@hadoop002 ~] # rpm-qa | grep-I dos2unix
Dos2unix-3.1-37.el6.x86_64
[root@hadoop002 ~] #
2. Dos2unix syntax:
Dos2unix [- hkqV] [- c convmode] [- o file...] [- n infile outfile...]
Parameter description:
-k: keep the date of the output file unchanged
-Q: quiet mode, no warning message.
-V: view version
-c: conversion patterns. Patterns are: ASCII, 7bit, ISO, Mac. Default is: ASCII.
-o: write to the source file
-n: write to a new file
3. Example
3.1 convert one file at a time
Dos2unix-k file
3.2 convert multiple files at a time
Dos2unix-k file1 file2 file3 or dos2unix-k-o file1 file2 file3
3.3 Save the results of the conversion in the new file, while the source file remains unchanged
Dos2unix-k-n oldfile newfile
About how to use the dos2unix command to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.