Re: tr problem

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

 



On 12Jun2008 16:35, Gene Heskett <gene.heskett@xxxxxxxxxxx> 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.

That's because \ is a shell quoting character. You need to quote it:-)

  tr -c '\r' '\n' <filename >filename2

Then tr will see the \ character.

| The manpage (and pinfo tr too) is, shall we say, completely lacking in how to 
| handle the file I/O.

As Les has mentioned, tr is a filter (like almost every UNIX command in
its bare form), so what you wrote is exactly right, except for the
quotes.

| Or is there a better tool for this than tr?

No, tr is the best thing for this particular purpose.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

So the master hit the novice upside the head with the back of his hand.
"Why did you do that!?"  "I do not want to have to learn another editor."
And the student was enlightened.        - Larry Colen <lrc@xxxxxxxxxx>

-- 
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