Skip to main content
Incorporated costa's suggestion
Source Link
tink
  • 7.8k
  • 2
  • 27
  • 33

Sticking with your awk ... just make sure you understand the difference between a field and a record separator :}

echo "a,b,c,d,e,f" | awk 'BEGIN{RS=","}{print $1=$1}'1'

But the tr solution in the comments is preferable.

Sticking with your awk ... just make sure you understand the difference between a field and a record separator :}

echo "a,b,c,d,e,f" | awk 'BEGIN{RS=","}{print }'

But the tr solution in the comments is preferable.

Sticking with your awk ... just make sure you understand the difference between a field and a record separator :}

echo "a,b,c,d,e,f" | awk 'BEGIN{RS=","}{$1=$1}1'

But the tr solution in the comments is preferable.

removed spurious $i
Source Link
tink
  • 7.8k
  • 2
  • 27
  • 33

Sticking with your awk ... just make sure you understand the difference between a field and a record separator :}

echo "a,b,c,d,e,f" | awk 'BEGIN{RS=","}{print $i}'

But the tr solution in the comments is preferable.

Sticking with your awk ... just make sure you understand the difference between a field and a record separator :}

echo "a,b,c,d,e,f" | awk 'BEGIN{RS=","}{print $i}'

But the tr solution in the comments is preferable.

Sticking with your awk ... just make sure you understand the difference between a field and a record separator :}

echo "a,b,c,d,e,f" | awk 'BEGIN{RS=","}{print }'

But the tr solution in the comments is preferable.

Source Link
tink
  • 7.8k
  • 2
  • 27
  • 33

Sticking with your awk ... just make sure you understand the difference between a field and a record separator :}

echo "a,b,c,d,e,f" | awk 'BEGIN{RS=","}{print $i}'

But the tr solution in the comments is preferable.