Re: tr problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2008-06-12 at 23:46 -0400, Gene Heskett wrote:
> On Thursday 12 June 2008, Les Mikesell wrote:
> >Gene Heskett wrote:
> >> I'm trying to convert a test file, src code for a legacy computer, whose
> >> eol is a single cr into one with a newline subbed for each cr, and tr is
> >> being a pita, it broken, or there is PEBKAC.
> >>
> >> If I use this syntax:
> >>
> >> tr -c \r \n <filename  >filename2
> >>
> >> Then the whole file is converted to nnnnnnnnnn's, every byte.
> >>
> >> The manpage (and pinfo tr too) is, shall we say, completely lacking in how
> >> to handle the file I/O.
> >>
> >> So how do you use tr?"
> >>
> >> Or is there a better tool for this than tr?
> >
> >The tr syntax would be
> >tr -d '\r'
> >but for one or a few files you can just load in vi (vim) and
> >
> >:set fileformat=unix
> 
> And that might be something that is not in the vim manpages Mike, thanks.
> 
> >and write it back out.
> >
> >Plus, you probably have a program called dos2unix installed...
> os uses and end of line characterws
> That is the other option & with my CRS, I couldn't remember that name with a 
> $1000 bill being offered.  I'm seemingly being reminded that memory is the 
> second thing to go. :)
> 
Except as stated by the OP your solution of dos2unix might not work, DOS
uses as eol characters cr followed by lf. So you would not want in that
case to replace a cr by a lf. You would want to just remove the cr.
In vi this is done by the command:
:.,$s/^V^M//
--
=======================================================================
Westheimer's Discovery: A couple of months in the laboratory can
frequently save a couple of hours in the library.
=======================================================================
Aaron Konstam telephone: (210) 656-0355 e-mail: akonstam@xxxxxxxxxxxxx

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux