I have something like a csv file in which the field delimiter is “@”.
ID@Name@Surname@Age@Profession@Address
1254343123@John@Smith@24@Engineer@Washington 23@Alexander@Kristofferson-Brown@Economic Advisor@Kent ...
I want to convert it into something more human-readable as in:
1254343123 John Smith 24 Engineer Washington 23 Alexander Kristofferson-Brown 35 Economic Advisor Kent
…where each column stars at a specific character.
I have tried something that takes advantage of the TAB-size value and adds several TABs to the field:
sed -e "{/@[^@]\{32,\}@/s/@\([^@]*\)@/\t\1\t/g};{/@[^@]\{24,31\}@/s/@\([^@]*\)@/\t\1\t/g};{/@[^@]\{16,23\}@/s/@\([^@]*\)@/\t\1\t\t/g};{/@[^@]\{8,15\}@/s/@\([^@]*\)@/\t\1\t\t/g};{/@[^@]\{2,7\}@/s/@\([^@]*\)@/\t\1\t\t\t/g}"
…which does not work in all cases.
Could somebody give me a hint as how to proceed?
PS: My intention is to use mainly sed (a one-liner) or if sed just doesn’t cut it, awk is OK.
Input
Output
If you want to make the field width (20 in the code above) a shell variable that can be passed in you do something like this: