You are putting quantifier *
at the wrong place.
Try instead this: –
grep '^[^\s]*' text1.txt > text2.txt
or, even better: –
grep '^\S*' text1.txt > text2.txt
\S
means match non-whitespace character. And anchor ^
is used to match at the beginning of the line.