I was trying to hack an installation script this morning, and noted that VI was showing me Carriage Return/Line Feed symbols at the end of each line, indicating that the file had last been edited on a Windows platform using a tool such as Notepad.exe.
I can see this because each line ends with the special characters ^M which is the ASCII code for CR/LF.
In the past, I've always used the dos2unix command to strip these out of a file.
However, dos2unix no longer appears to be installed out-of-the-box with Ubuntu 10.04 or, worse still, available via the normal Canonical repositories; I tried installing it using the command: -
sudo apt-get install dos2unix
but got the "Computer says 'NO'" message of: -
E: Couldn't find package dos2unix
Googling around, I found this blog posting: -
http://mediakey.dk/~cc/dos2unix-on-ubuntu-and-debian/
which refers to a different package - tofrodos - which provides similar functionality.
I installed it using a similar command: -
sudo apt-get install tofrodos
accepting the warning that this package isn't certified as being an official part of Ubuntu.
Once done, I get two new commands: -
/usr/bin/todos
/usr/bin/fromdos
which equate to my old friends: -
dos2unix
unix2dos
respectively.
Sweet :-)
Geeking in technology since 1985, with IBM Development, focused upon Docker and Kubernetes on the IBM Z LinuxONE platform In the words of Dr Cathy Ryan, "If you don't write it down, it never happened". To paraphrase one of my clients, "Every day is a school day". I do, I learn, I share. The postings on this site are my own and don’t necessarily represent IBM’s positions, strategies or opinions. Remember, YMMV https://infosec.exchange/@davehay
Subscribe to:
Post Comments (Atom)
Reminder - installing podman and skopeo on Ubuntu 22.04
This follows on from: - Lest I forget - how to install pip on Ubuntu I had reason to install podman and skopeo on an Ubuntu box: - lsb_rel...
-
Why oh why do I forget this ? Running this command : - ldapsearch -h ad2012.uk.ibm.com -p 389 -D CN=bpmbind,CN=Users,DC=uk,DC=ibm,DC=com -w...
-
Error "ldap_sasl_interactive_bind_s: Unknown authentication method (-6)" on a LDAPSearch command ...Whilst building my mega Connections / Domino / Portal / Quickr / Sametime / WCM environment recently, I was using the LDAPSearch command tha...
-
Whilst building a new "vanilla" Kubernetes 1.25.4 cluster, I'd started the kubelet service via: - systemctl start kubelet.se...
2 comments:
Thank you, I use very often dos2unix and I was really wondering it was! (I use it on the http://piwigo.org project to convert patch files send by contributors running on Windows.
Pierrick - glad to be of use :-)
Post a Comment