sed -r 's/^[^ ]+[ ]+//' in.txt
(GNU sed; on OSX, use -E
instead of -r
).
Update:
As @Jotne points out, the initial ^
is not strictly needed in this case - though it makes the intent clearer; similarly, you can drop the []
around the second space char.
The above only deals with spaces separating the columns (potentially multiple ones, thanks to the final +
in the regex), whereas the OP more generally mentions whitespace.
Generalized whitespace version:
Note: In the forms below, \s
and [:space:]
match all kinds of whitespace, including newlines. If you wanted to restrict matching to spaces and tabs, use [ \t]
or [:blank:]
.
sed -r 's/^\S+\s+//' in.txt
(GNU sed; this form will not work on OSX, even with -E
.)
POSIX-compliant version (e.g., for AIX - thanks, @NeronLeVelu):
sed 's/^[^[:space:]]\{1,\}[[:space:]]\{1,\}//' in.txt