remove_special_chars_from_windows_files
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
remove_special_chars_from_windows_files [2017/07/19 13:59] – walkeradmin | remove_special_chars_from_windows_files [2023/03/09 22:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 8: | Line 8: | ||
\\ | \\ | ||
\\ | \\ | ||
- | dos2unix | + | Below is a file that I copied from Windows to a CentOS linux server, it dind't matter if I copied the file, or did a copy/paste, the issue still arose. After each line you can see a <color # |
- | vi -b filename | + | \\ |
+ | \\ | ||
+ | When you edit the file in vi, you can't see these special characters, you have use another switch with vi to show them. Run vi using a <color # | ||
+ | \\ | ||
+ | | ||
+ | ---- | ||
- | # | + | #!/bin/bash<color #ed1c24>^M</ |
- | # Install useful tools^M | + | # Install useful tools<color #ed1c24>^M</ |
- | ^M | + | <color #ed1c24>^M</ |
- | yum install epel-release -y^M | + | yum install epel-release -y<color #ed1c24>^M</ |
- | yum install htop -y^M | + | yum install htop -y<color #ed1c24>^M</ |
- | yum install nload -y^M | + | yum install nload -y<color #ed1c24>^M</ |
- | yum install iperf -y^M | + | yum install iperf -y<color #ed1c24>^M</ |
- | yum install tcpdump -y^M | + | yum install tcpdump -y<color #ed1c24>^M</ |
- | yum install ncdu -y^M | + | yum install ncdu -y<color #ed1c24>^M</ |
- | yum install net-tools -y^M | + | yum install net-tools -y<color #ed1c24>^M</ |
- | rpm --import http:// | + | rpm --import http:// |
- | touch / | + | touch / |
- | echo " | + | echo " |
- | name=Fedora Core \$releasever - \$basearch - ATrpms^M | + | name=Fedora Core \$releasever - \$basearch - ATrpms<color #ed1c24>^M</ |
- | baseurl=http:// | + | baseurl=http:// |
- | gpgkey=http:// | + | gpgkey=http:// |
- | enabled=1^M | + | enabled=1<color #ed1c24>^M</ |
- | gpgcheck=1" | + | gpgcheck=1" |
- | yum install ffmpeg -y | + | yum install ffmpeg -y\\ |
- | ~ | + | |
+ | ---- | ||
+ | You can remove these special characters in Linux using a variety of methods, here are two. | ||
+ | \\ | ||
+ | 1. In vi, just delete the ^M characters and save the file. | ||
+ | | ||
+ | 2. Install dos2unix (yum install dos2unix) and execute this on your file (dos2unix filename) | ||
+ | and it will remove them for you, handy if it is a big file. | ||
+ | \\ |
remove_special_chars_from_windows_files.1500469189.txt.gz · Last modified: 2023/03/09 22:35 (external edit)