Remove special character from csv file using bash -
i have csv file in first([) , second last column (]) contain special character. example given below
col1 col2 col3 ..... coln-1 coln [number number number ..... number] number i want remove [ first , ] second last column using bash script
with sed 's/]//g' file, can remove ]. have error [ same statement.
your approach sed sound. need know [ , ] special characters in (all flavors of) regular expressions, therefore need escaping backslashes. , name choice of 2 characters, […] used, so:
sed 's/[\[\]]//g' test.csv this, however, can done quicker using tr can remove given characters:
tr -d '[]' < test.csv > test2.csv
Comments
Post a Comment