problem in tr command
my input file is in this format:
RSU-1-1 15:40 2 I used tr command to replace '\n' for '\t'= tr '\n' '\t' But, when I run it, the output is: RSU-1-1 15:40 2 I want to have more spaces between RSU-1-1 and 15:40 I tried it by: RSU-1-10 15:40 2 and it worked correctly: RSU-1-10 15:40 2 |
A tab uses a fixed length (8 is very common).
The first entry you use (RSU-1-1) is 7 characters and using a tab after that will only add 1. The second example (RSU-1-10) has 8 characters and using a tab will add 8: Code:
$ tr '\n' '\t' < infile You can use awk to do this: Code:
$ awk 'BEGIN { ORS=" " } { print }' infile You could also set the tab width before executing the tr command: Code:
$ tabs -11 |
Quote:
|
All times are GMT -5. The time now is 11:50 AM. |