Languages
[Edit]
EN

Bash - cut n first characters from string

10 points
Created by:
Lani-Skinner
748

in this article, we would like to show how to remove first N characters from some string in Bash.

Quick solution (cutting 2 first characters):

Where: tail -c +3 cuts first characters starting counting them from 1.

Output:

 

Practical example

Edit

In this section, you will find a reusable function that cuts text.

See also

Edit
  1. Bash - get n first characters from string 

Alternative titles

  1. Bash - remove n first characters from string
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join