A Little Devil Called tr

 in
Here's a useful command for translating or deleting characters in a file.
______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Filtering fields of a file

barun parichha's picture

Here r my set of records in file
File.txt:
1::2:3:4
4:5:6:7:8
7:8:9:10:
7: 8 9:1:2:3
::::

The fields are separated by field separator(:).
I want to print the fields of this record. There are two problems while printing this. 1) some fields are blank(::), 2) Some fields contains more then one characters separated by space character (:8 9:)
Can it be done using tr ?

pleas let me wat it does

Anonymous's picture

tr "(){}[]\"'<>;&@" " " < $data_dir/SCell_$dt.wk > $data_dir/SCell_$dt.sort.init

Re: Take Command: A Little Devil Called tr

Anonymous's picture

I would like to be able to count how many of each letter of the alphabet are in a file, reguardless of case. I'm trying to figure out how to make tr replace EACH letter with the letter followed by a line feed.

Thank you.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix