Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Removing Control characters from file

  • 09-12-2002 12:02PM
    #1
    Registered Users, Registered Users 2 Posts: 2,694 ✭✭✭


    Hi guys. I'm having a problem with a file that was originally created with MS notepad. It contains the carrage returns (^M). I am using Sco Unix and have always used g/^M/s///g which works, however it won't for this file for some reason. Anyone know another alternitive using SED etc? This is wreaking my head on a Monday morning.
    Thanks.


Comments

  • Registered Users, Registered Users 2 Posts: 8,702 ✭✭✭jmcc




  • Registered Users, Registered Users 2 Posts: 2,694 ✭✭✭Dingatron


    Excellent. My Monday morning blues are gone. That'll do nicely. Thanks jmcc for the quick reply. I owe u one :-)


  • Closed Accounts Posts: 741 ✭✭✭longword


    tr is a fun tool. In this case, tr -d '\r' should get the job done.


  • Registered Users, Registered Users 2 Posts: 2,694 ✭✭✭Dingatron


    Wow, so many tools so little time. Both sed and tr seem much better options than vi. Problem sorted. Still wonder why it wouldn't work with vi. Thanks again for the replys.


  • Registered Users, Registered Users 2 Posts: 1,393 ✭✭✭Inspector Gadget


    According to this page, SCO ships with unix2dos and dos2unix, so you could always just use them instead?

    Example:
    dos2unix <originalfile> <newfile>

    Gadget


  • Advertisement
Advertisement
Advertisement