awk: how to delete first and last value on entire column -


I have a data that contains many columns. On a column, I would like to delete two commas which, at the beginning and in the whole Are located at the end of the column. My data looks something like this:

  a, 3,4,3,2, b, 3,4,5,1, c, 1,5,2,4,5, d , 3,6,24,62,3,54,   

How can someone remove the first and last comma on this data? I appreciate it.

  awk '{sub (/, /, "", $ 0); Print substrag ($ 0,0, length ($ 0) -1)} 'input.txt   

Output:

  a 3,4,3 , 2, b3,4,5,1, c 1,5,2,4,5, d3,6,24,62,3,54,    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -