Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ echo '"BARCELONA";"";"Country.666;53";15' | csvtool -t ';' col 1- -
- BARCELONA,,Country.666;53,15
- $ echo '"BARCELONA";"";"Country.666;53";15' | csvtool -t ';' col 1,3 -
- BARCELONA,Country.666;53
- $ perl -MText::CSV -lpe '
- BEGIN{$p = Text::CSV->new({sep_char => ";"})}
- $_ = join "|", map { /^d+$/ ? $_ : qq("$_") } $p->fields() if $p->parse($_)
- ' INPUT
- "BARCELONA"|""|"Country.666;53;98"|15|19|"test"|4343|63647|655848
- $ csvformat -d';' -D'|' INPUT
- BARCELONA||Country.666;53;98|15|19|test|4343|63647|655848
- $ csvformat -d';' -u2 -D'|' -U2 INPUT
- "BARCELONA"|""|"Country.666;53;98"|15.0|19.0|"test"|4343.0|63647.0|655848.0
- cat file.txt | awk -v FPAT='[^;]+|"[^"]+"' '{ for( col=1; col<=NF; col++ ) { printf "%s|", $col; } print "" }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement