regex - To remove lines from a csv which have only commas -


i have file has lines have commas, , no data. issue lines not have fixed number of commas. data may below-

99,abc,123,, bcd,123,th ,,bcd,123,th ,,,,bcd,123,th ,,, ,,,,, 

the output should like

99,abc,123,, bcd,123,th ,,bcd,123,th ,,,,bcd,123,th 

i have remove lines have commas.

try single grep follows.(negating lines have started comma , till end have comma, in commands same logic used)

grep -v '^,*$'  input_file 

try awk solution follows.

awk '!/^,*$/'  input_file 

try sed solution on same.

sed -n '/^,*$/d;p'  input_file 

Comments

Popular posts from this blog

minify - Minimizing css files -

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -