Reputation: 305
please suggest me how to fix this annoying issue. I use awk to make a simple calculation and then print the result on a new tab separated column. It works, but awk prints the result on a column on a new line. Please have a look
chr1 839976 840333 44 66151894
chr1 855835 856060 23 66151894
chr1 860112 860337 25 66151894
awk 'BEGIN { OFS = "\t" } { $6 = $3-$2 } 1 ' file1.txt > result1.txt
This command print something like this
chr1 713869 714267 79 66151894
398
chr1 839976 840333 44 66151894
357
chr1 855835 856060 23 66151894
225
Can you fix the command properly?
Upvotes: 0
Views: 257
Reputation: 133498
When I run your command it works fine for me, as a assumption could you please check if you have carriage characters in your Input_file by doing cat -v Input_file
then you could use following commands to remove them first.
tr -d '\r' < Input_file > temp_file && mv temp_file Input_file
Then you could give a shot to your own command.
Upvotes: 1