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.

Geek Guide
The DevOps Toolbox

Tools and Technologies for Scale and Reliability
by Linux Journal Editor Bill Childers

Get your free copy today

Sponsored by IBM

Webcast
8 Signs You're Beyond Cron

Scheduling Crontabs With an Enterprise Scheduler
On Demand
Moderated by Linux Journal Contributor Mike Diehl

Sign up and watch now

Sponsored by Skybot