Actually I want to count the number of positive and negative numbers in the list eventually.
So I thought I could remove the numbers that don't have the minus sign in front of them using "tr" , and then count the remaining numbers.
Is there any other way to do it? To count the number of positive and negative numbers without removing? It is a question that I saw somwewhere, it asked to do without using scripts, grep, sed or awk.
---------- Post updated at 07:20 PM ---------- Previous update was at 07:15 PM ----------
I tried in a different shell now. It outputs "hh".
Can you explain exactly how that works? I am not able to understand what is replaced by what in tr -c.
Thanks,
Prasanna
---------- Post updated at 07:23 PM ---------- Previous update was at 07:20 PM ----------
Only certain versions of "tr" will work with the above syntax.
Most of them will just put a single "h" character in the first position of the translation table and nowhere else.
This is the correct syntax to expand the string of "h" characters to fill every slot in the transalation table except the linefeed character.