Inserting a character in front of every instance of a certain character in vi -
i have dataset have put excel every time there isn't data point instance, -1 put there instead, messing graph trying make. did research , people said if put asterix (*) before data point in excel, exclude point graph. can type ios vi insert asterix before every instance of -1? thanks!
assuming working csv file, should able distinguish -1 -1.4 or 1e-1 seeing if value comma separated.
to make pattern easier match, first modify file insert , beginning , end of lines.
:%s/.*/,&,/ then, apply substitution of -1 *-1 2 times. second time deal 2 -1 values in row.
:%s/,-1,/,*-1,/g :%s/,-1,/,*-1,/g then, remove , beginning , end.
:%s/^,\(.*\),$/\1/
Comments
Post a Comment