How to cut a string after a number of characters in unix?

10,837

Consider using cut instead of sed:

cut -c-10

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

Share:
10,837
Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin almost 2 years

    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.