Skip to main content
added 5 characters in body
Source Link
fd0
  • 1.5k
  • 1
  • 10
  • 14

With GNU sed :

sed '2,$ s/[^\t]*\t//' file

Portable :

tab=$(printf '\t')
sed '2,$ s/[^'"$tab"']*'"$tab"'//' file
  • 2,$ from the second line to the last line
  • s/[^\t]*\t// substitute any character except the tab character to the next tab (the first tab) with nothing.

With GNU sed :

sed '2,$ s/[^\t]*\t//' file

Portable :

tab=$(printf '\t')
sed '2,$ s/[^'"$tab"']*'"$tab"'//'
  • 2,$ from the second line to the last line
  • s/[^\t]*\t// substitute any character except the tab character to the next tab (the first tab) with nothing.

With GNU sed :

sed '2,$ s/[^\t]*\t//' file

Portable :

tab=$(printf '\t')
sed '2,$ s/[^'"$tab"']*'"$tab"'//' file
  • 2,$ from the second line to the last line
  • s/[^\t]*\t// substitute any character except the tab character to the next tab (the first tab) with nothing.
Source Link
fd0
  • 1.5k
  • 1
  • 10
  • 14

With GNU sed :

sed '2,$ s/[^\t]*\t//' file

Portable :

tab=$(printf '\t')
sed '2,$ s/[^'"$tab"']*'"$tab"'//'
  • 2,$ from the second line to the last line
  • s/[^\t]*\t// substitute any character except the tab character to the next tab (the first tab) with nothing.