You're viewing a comment by MrDuke and its responses.

MrDuke Permalink
September 21, 2011, 10:46

I want to remove lines which having number of commas char greater than N.
counld anyone help me :( ?

Comment Responses

September 21, 2011, 20:25

Here is a trick to do it. Suppose N=5, then this one-liner will delete all lines with 5 commas:

sed -n '/.*,.*,.*,.*,.*,/d
Anirudh Permalink
January 31, 2016, 13:50
sed -e 's/,/&/3; T' -e 'd'

will delete lines with comma count greater than 2, i.e., 3 or more.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "cloud_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.