79298622

Date: 2024-12-20 23:41:24
Score: 2.5
Natty:
Report link

I would like to add that

awk '{FS="|";OFS="\t"} {print $1,$2,$3,$4,$5}'

and

awk '{print $1,$2,$3,$4,$5} {FS="|";OFS="\t"}'

have the almost the outputs in my version of awk

with FSOFS first adding 1 extra \t at the end of first line.

@Thor has the best answer https://stackoverflow.com/a/16203497/22188182

#simplest
awk '{print $1,$2}' FS=',' OFS='|'
#most powerful for more complex FS
awk 'BEGIN {FS="|"; OFS="\t"} {print $1, $2}' file
#clean
awk -v FS='|' -v OFS='\t' '{print $1, $2}' file
Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Has code block (-0.5):
  • User mentioned (1): @Thor
  • Low reputation (1):
Posted by: Shiyi Yin