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.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState