r.v
r.v

Reputation: 4877

Match a line with no space

How do I match a line with no space in grep? For example,

xyz
a b c
d e f

Only xyz should match. The pattern ^\S*$ does not seem to be working.

Upvotes: 0

Views: 2759

Answers (1)

nu11p01n73R
nu11p01n73R

Reputation: 26667

Something like

$ grep '^\S*$' input
xyz

OR

$ grep '^[^ ]*$' input
xyz

Upvotes: 2

Related Questions