regex - replacing tabs with single tab in sed -
i want replace multiple tabs single tab sed. trying use
sed 's:\t+:\t:' .\text.csv > newtext.csv
but doesn't seem work
if open in sublime , replace regex \t+
\t
works properly
what wrong sed?
also, if replace tabs comma
sed 's:\t\t*:,:g' text.csv > newtext.csv
i kind of line
264262360,20030826,200308,2003,2003.6466,bus,employer,,,,,,bus,,, ,,,,,,,,,,0,051,051,05,1,3.4,12,2,12,5.24866163479182,1
you can use tr
replace multiple tabs single one:
tr -s '\t' '\t' < inputfile > outfile
the -s
option squeezes repeats:
-s, --squeeze-repeats
replace each input sequence of repeated character listed in set1 single occurrence of character
Comments
Post a Comment