I have a file foo
that has the following data:
A<|>B<|>C<|>D
1<|>2<|>3<|>4
I want to properly access each column using awk, but it isn't properly interpreting the field separator.
When I run:
head foo |
awk 'BEGIN {FS="<|>"} {out=""; for(i=1;i<=NF;i++){out=out" "$i}; print out}'
instead of printing
A B C D
1 2 3 4
it prints
A | B | C | D
1 | 2 | 3 | 4
What's the reason behind this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…