PraveenKumarBS

Changing from row to column with Shell script command

Nov 14th, 2017
31
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. I hope
  2. final.csv contains below content
  3.  
  4. 0 17.92204 -3.017933 35.14229
  5. 20.89817 -2.37854 66.51003
  6. 1 18.27151 -3.179997 35.20044
  7. 21.48396 -2.461451 66.48988
  8. 2 18.22776 -3.566021 34.87167
  9. 21.78348 -2.575202 66.51389
  10.  
  11.  
  12. Command used to get desired output
  13.  
  14. cat final.csv | sed '/^$/d '|sed -r “s/\s+/ /g" |sed "N;s/\n/ /g"
  15. 0 17.92204 -3.017933 35.14229 20.89817 -2.37854 66.51003
  16. 1 18.27151 -3.179997 35.20044 21.48396 -2.461451 66.48988
  17. 2 18.22776 -3.566021 34.87167 21.78348 -2.575202 66.51389
RAW Paste Data