How to delete all characters in one line after point with with sed?

I have a file with multiple lines like this:

  • 123456789 3483 98765432 56345
  • 985745634 3469 67495735 87654

Now I want to delete all after the first 10 characters. So I only want my output to be:

  • 123456789
  • 985745634

I was googling for that particular example of sed but didn't find any help in those examples.

1 Answer 1


Consider using cut instead of sed:

cut -c-10

This example extracts 10 first characters from the beginning of the line.

Not the answer you're looking for? Browse other questions tagged .