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.
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Author by
Admin
Updated on September 18, 2022Comments
-
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.