[Question]
  [
This is my head:
```
\         /-- -|
 /   -\  |  |  |
\      \ \  \  |
 --\    | \  | |
    / |--| / / |
 /|-  //--| /  |
| |  ||   //\  |
| \  /|  //  \ |
```
It consists of exactly eight hairs. My hair is too long. Please cut each individual strand to a length I specify.
## Input
The main attraction in this section is the actual head of hair. Here's a **graphical, color-coded representation, along with an animation**, for the lazy:
![color coded thingy](https://i.stack.imgur.com/ZynZy.png) ![animated thingy](https://i.stack.imgur.com/2j536.gif)
And here is a **full specification** for what a set of hairs is:
* The individual hairs, which we will call **strands**, will be made out of the `/`, `\`, `|`, and `-` ASCII characters, henceforth known as **atoms**.
* The entire **head** of hear (all of the strands combined) will be `c` columns by `r` rows, where `c` ≥ 1 and `r` ≥ 2.
* Each strand will...
	+ start at the last row of the head (row `r` - 1).
	+ have a length `l` where `l` ≥ 2.
* Strands may be parsed with the following method:
	1. Start at the bottom of the strand. This will be a `/`, `|`, or `\` atom, which we will call the **root**. (Strands are parsed from left to right, ordered by the root.)
	2. Find the atom that points towards the root.
		+ A `|` atom points up and down. A `-` atom points left and right (but can never point to the root since only roots can be in the bottom row). A `/` atom points left-down and up-right, and a `\` atom does the opposite.
		+ There will always be exactly one atom that points towards the root atom.
	3. Find an *unused* atom (one that is not yet part of any strand) that points towards this atom and is also not below this atom (hair can't grow downwards, but sideways is okay).
		+ If there are zero, you have reached the end of the strand!
		+ If there is one, this is the next atom of the strand. Repeat step 3 with this atom. (This atom is now marked as "used" for the purposes of step 3, since it's part of a strand.)
		+ There will never be multiple *unused* atoms here at any point in the head.
The **input format** will be:
* A head of hair. Can be input as-is (multiline input with literal newlines), or with a delimiter of your choice in place of newlines. Note that the head will always be a rectangle; i.e. trailing whitespace will be added as necessary (the weird straight line hair at the right is just to eliminate extra trailing whitespace to avoid confusion).
* A number ≥ 1 specifying how much hair to cut. This will be described in detail in the next section.
You may accept input to a function, use STDIN/STDOUT, etc. (anything [reasonable](http://meta.codegolf.stackexchange.com/a/1326/3808)).
## Output
Your output will be the head of hair with the haircut applied. To give a haircut, simply reduce the length of each strand of hair by the amount specified (which will always be 1 or greater), starting from the endpoint of the hair moving towards the root. However, *always* leave the root intact!
Here's a simple example. Say the input for the head is
```
\ 
 /
| 
| 
```
With a second input of `2`, you would cut two atoms from the strand and get a result of
```
|
|
```
And with an input of `42`, the output would just be
```
|
```
Note that whitespace before and after the head is completely irrelevant; you can trim extra newlines or you could add more padding. It doesn't matter, as long as the head remains intact. (You may do whatever you want with trailing whitespace as well.)
## Test Cases
For all test cases, the example presented at the very beginning of this post will be used.
Haircut length = 1:
```
          /-   |
 /    \  |     |
\      \ \  \  |
 --\    | \  | |
    / |--  / / |
  |-  //--| /  |
| |  ||   //   |
| \  /|  //  \ |
```
Length of 3:
```
         |      
         \     |
 --\    | \    |
    / |--  / / |
  |-  //  | /  |
  |  ||   //   |
| \  /|  //  \ |
```
Length of 7:
```
  |-  /   |     
  |  |    /    |
| \  /|  //  \ |
```
Length of 1337:
```
| \  /|  //  \ |
```
## Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes will win!
  
[Answer]
# JavaScript (E6) 195 ~~212 222 232~~
Using a recursive function R to find the path of each strand and marking the positions starting from 1 for the farest from the root. Then it's easy, in a second pass, to substitute the lower marked position with blanks.
```
F=(h,t,
   n=[...h],c=h.search('\n'),
   R=p=>[1,-1,c+2,c+1,c].some((d,i)=>n[p-d]=='--\\|/'[i]?n[p-=d]=1:0)&&R(p)+(R[p]=l++)
  )=>
  n.map((v,p)=>R[p]<t?' ':h[p],n.map((a,p)=>!h[p+c]&a>' '&&R(p,l=0))).join('')
```
**Test** in FireFox/FireBug console
```
head = "\\         /-- -|\n /   -\\  |  |  |\n\\      \\ \\  \\  |\n --\\    | \\  | |\n    / |--| / / |\n /|-  //--| /  |\n| |  ||   //\\  |\n| \\  /|  //  \\ |";
console.log(F(head,0))
console.log(F(head,1))
console.log(F(head,3))
console.log(F(head,7))
console.log(F(head, 1337))
```
*Output*
```
\         /-- -|
 /   -\  |  |  |
\      \ \  \  |
 --\    | \  | |
    / |--| / / |
 /|-  //--| /  |
| |  ||   //\  |
| \  /|  //  \ |
          /-   |
 /    \  |     |
\      \ \  \  |
 --\    | \  | |
    / |--  / / |
  |-  //--| /  |
| |  ||   //   |
| \  /|  //  \ |
         |      
         \     |
 --\    | \    |
    / |--  / / |
  |-  //  | /  |
  |  ||   //   |
| \  /|  //  \ |
  |-  /   |     
  |  |    /    |
| \  /|  //  \ |
| \  /|  //  \ |    
```
]