[Question]
  [
Take a flag, like this one:
```
-----------------------------
|             |             |
|             |             |
|=============+=============|
|             |             |
|             |             |
-----------------------------
```
And a number input: the "wave length"
Say the wave length was 5. Then, every 5 characters along the line from the beginning, replace the next character a `-` with `\` and shift all the characters after it one row down. Repeat this until the end. You end up with:
```
-----\
|     -----\
|           -----\
|=====        |   -----\
|     ======  |         -----
|           ==+===          |
-----\        |   ======    |
      -----\  |         ====|
            -----\          |
                  -----\    |
                        -----
```
If you end up not being able to make a full wave length along at the end, the flag is finished. Just remain flat until the end.
You can assume that all the lines are of the same length and that the top and bottom lines are composed entirely of `-` (0x2D) and the rest of the characters are in `!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~`, or is a space (). (So it's ascii value is `x`, where `31 < x < 127`)  
The flag will be at least 3 tall and 3 wide.
Wave length will be a non-negative integer (>= 0).
(You can also have wave length 1 be the smallest wavelength, so the above example would have wave length 6. This is OK.)
Your i/o of flag can be as arrays of lines or a string with multiple lines.
The output flag may have trailing spaces, but can only have leading spaces so long as it is the same on every flag. Trailing space on an input flag may be deleted.
## Scoring
This is code-golf, so the shortest solution, in bytes, wins.
## Test cases
```
---
abc
---
2
--\
abc
--\
-----
| + |
-----
10
-----
| + |
-----
---------------------------------------
|&&&&&&                         &&&&&&|
|&&&&&&                         &&&&&&|
|&&&&&&                         &&&&&&|
|&&&&&&          .\^/.          &&&&&&|
|&&&&&&        . |   | .        &&&&&&|
|&&&&&&        |\|   |/|        &&&&&&|
|&&&&&&     .--'       '--.     &&&&&&|
|&&&&&&      \           /      &&&&&&|
|&&&&&&       >         <       &&&&&&|
|&&&&&&      '~|/~~|~~\|~'      &&&&&&|
|&&&&&&            |            &&&&&&|
|&&&&&&                         &&&&&&|
|&&&&&&                         &&&&&&|
---------------------------------------
12
------------\                          
|&&&&&&      ------------\             
|&&&&&&                   ------------\
|&&&&&&                         &&&&&&|
|&&&&&&                         &&&&&&|
|&&&&&&          .\^/.          &&&&&&|
|&&&&&&        . |   | .        &&&&&&|
|&&&&&&     .  |\|   |/|        &&&&&&|
|&&&&&&      --'       '--      &&&&&&|
|&&&&&&      \           /.     &&&&&&|
|&&&&&&       >         <       &&&&&&|
|&&&&&&      '~|/~~|~~\|~'      &&&&&&|
|&&&&&&            |            &&&&&&|
|&&&&&&                         &&&&&&|
------------\                   &&&&&&|
             ------------\      &&&&&&|
                          ------------\
-----------------------
|-._`-._ :| |: _.-'_.-|
|   `-._`:| |:`_.-'   |
|-------`-' '-'-------|
|------_.-. .-._------|
|  _.-'_.:| |:._`-._  |
|-'_.-'  :| |:  `-._`-|
-----------------------
4
----\
|-._`----\
|   `-._ :----\
|-----._`:| |: ----\
|-------`-| |:`_.-'_---
|  _.--_.-' '-'_.-' .-|
|-'_.-'_.:. .-.-----  |
----\-'  :| |:._------|
     ----\| |: _`-._--|
          ----\ `-._  |
               ----\`-|
                    ---
---------------
---------------
---------------
---------------
---------------
5
-----\         
-----------\   
---------------
---------------
-----\---------
      -----\---
            ---
-------------------------------------------
|*  *  *  *  * |##########################|
| *  *  *  *  *|                          |
|*  *  *  *  * |##########################|
| *  *  *  *  *|                          |
|*  *  *  *  * |##########################|
| *  *  *  *  *|                          |
|*  *  *  *  * |##########################|
|---------------                          |
|#########################################|
|                                         |
|#########################################|
|                                         |
|#########################################|
-------------------------------------------
0
\
|\
|*\
|  \
|** \
|   *\
|**   \
|   ** \
|**    *\
|-  **   \
|#-    ** \
| #-**    *\
|# #-  **   \
| # #-    ** \
\# # #-**    *\
 \# # #-  **   \
  \# # #-    **|\
   \# # #-**   |#\
    \# # #-  **| #\
     \# # #-   |# #\
      \# # #-**| # #\
       \# # #- |# # #\
        \# # #-| # # #\
         \# # #-# # # #\
          \# # # # # # #\
           \# # # # # # #\
            \# # # # # # #\
             \# # # # # # #\
              \# # # # # # #\
               \# # # # # # #\
                \# # # # # # #\
                 \# # # # # # #\
                  \# # # # # # #\
                   \# # # # # # #\
                    \# # # # # # #\
                     \# # # # # # #\
                      \# # # # # # #\
                       \# # # # # # #\
                        \# # # # # # #\
                         \# # # # # # #\
                          \# # # # # # #\
                           \# # # # # # #\
                            \# # # # # # #\
                             \# # # # # # |
                              \# # # # # #|
                               \# # # # # |
                                \# # # # #|
                                 \# # # # |
                                  \# # # #|
                                   \# # # |
                                    \# # #|
                                     \# # |
                                      \# #|
                                       \# |
                                        \#|
                                         \|
                                          \
```
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~25~~ ~~23~~ ~~26~~ 25 bytes
*-2 thanks to Adnan*
*-1 thanks to Emigna*
*+3 thanks to Jonathan Allan (thanks for spending the time to catch that invalidity!)*
```
øvyN>²Öi¦¨'\.ø}N²÷ú}).Bø»
```
[Try it online!](https://tio.run/nexus/05ab1e#@394R1mln92hTarxmYeWHVqhHqN3eEet36FNh7cf3lWrqed0eMeh3f//R6vr4gPqOgrqNQrIAI1HnAJbZKCNwquhjhX4fRHLZQQA "05AB1E – TIO Nexus")
This is 1-indexed instead of 0, +2 bytes if that isn't okay.
```
ø                                    # Transpose.
 vy                }                 # For each column...
   N>²Öi¦¨'\.ø}                      # Replace outside dashes with slants.
               N²÷                   # Current index / input #2.
                  ú                  # Prepend that many spaces to current column.
                    ).Bø             # Join, pad, transpose back.
                        »            # Print with newlines.
```
Emigna/Adnan/Anyone - There HAS to be a better solution to replace those slants, but I'm stumped.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 35 bytes
```
j.ts.e+L*k;?qQtlb+PbjPteb*2\\bcC.zh
```
[Try it online!](http://pyth.herokuapp.com/?code=j.ts.e%2BL%2ak%3B%3FqQtlb%2BPbjPteb%2a2%5C%5CbcC.zh&input=5%0A-----------------------------%0A%7C+++++++++++++%7C+++++++++++++%7C%0A%7C+++++++++++++%7C+++++++++++++%7C%0A%7C%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%2B%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%7C%0A%7C+++++++++++++%7C+++++++++++++%7C%0A%7C+++++++++++++%7C+++++++++++++%7C%0A-----------------------------&debug=0)
[Answer]
# [Python 2](https://docs.python.org/2/), 129 bytes
```
lambda f,n,j=''.join:map(j,zip(*[i/n*' '+'-\\'[i%n>n-2]+j(s[1:-1])+'-\\'[i%n>n-2]+len(f[0])/n*' 'for i,s in enumerate(zip(*f))]))
```
[Try it online!](https://tio.run/nexus/python2#3VTRaoMwFH3PV1wsW5I2iev2MJDZHzEO7KYSsamoexkXf72LtoyuoHUPG2OHkIfck5Pc5HDyUB/KZLd9TSATVhQhparYGxvskooV4t1UbBkZ3y4p0BWVWtPI3NiNlffxqmBNtA7kOuaXlTK1LIvuYn7cmO1rMKIBYyG1b7u0TtqUDdIZ5zHnh6xM8gZCiDzPI3IeCN4OgDEcy/jzPKWffXWVpwDdjKCu8FAPPB@neEpKeipTKdW4nj5rwJ86d/NJe5q6H@3Q7zrsOo0dvfp@@Bv/MdMvzlqCnPxFku0LuViTs323BDgbuBiF6wG@kHG0GcD/rXvxiJO6i7no7zsXf0P3Gz5ztowJ6aOzT0cBZR@ffWgOYSkgehTwIMClb0Cgqo1tgWp7TG@WDyyXzrFqqtK0zNPW407Ehe0H "Python 2 – TIO Nexus")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 29 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
s”\⁹¦€Fð€0,1¦Zsð⁶ẋ;Ð€µ@"J;/z⁶
```
Input and output flags are lists of lines.  
Wave length is 1-indexed.  
Always produces one line of spaces.  
(all of the above is explicitly allowed in the posted question)
**[Try it online!](https://tio.run/nexus/jelly#@1/8qGFuzKPGnYeWPWpa43Z4A5A00DE8tCyqGMhu3PZwV7f14QlAwUNbHZS8rPWrgGL/H@7ecnh55P//usQBrho1MFDABSDSNbRXpxcTp69HUJ2eQg2QrFHQI6CuJgasTr8Gnzo9XV11qLS6rq4ebvNikDygj89eO7gyG3zuU6@r0a@rq6mri6mpUycYfjX0iA8i08t/Q2MA)** (footer to make IO look pretty - takes and receives flags as multiline text)
### How?
A pretty similar method to carusocomputing's [05ab1e answer](https://codegolf.stackexchange.com/a/120113/53748), which I have not managed to golf down more.
```
s”\⁹¦€Fð€0,1¦Zsð⁶ẋ;Ð€µ@"J;/z⁶ - Main link: list of lists f, number p
            ¦                 - apply to indexes (of f)
         0,1                  - ... 0 paired with 1 (i.e. last & first -> bottom & top)
       ð€                     - the previous chain with p as right argument for €ach:
s                             -   split into chunks of length p
    ¦€                        -   apply to indexes for €ach
   ⁹                          -   ... link's right argument, p
 ”\                           -   the character '\' (a replacement - if the index is out of bounds this has no effect - although this might change in the future.)
             Z                - transpose the edited flag
              s               - split into chunks of length p
                        J     - range of length = [1,2,...,nChunks]
               ð     µ@"      - zip with reversed arguments (call those i):
                ⁶             -   literal space
                 ẋ            -    repeated i times
                  ;Ð€         -    concatenate mapped across the chunks
                         ;/   - undo the split (reduce with concatenation)
                           z⁶ - transpose with a filler of space characters
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), 31 bytes
```
x"X@q1GQ&\Z"@b1G=?'\'5L(]h]Xhc!
```
[Try it online!](https://tio.run/nexus/matl#@1@hFOFQaOgeqBYTpeSQZOhua68eo27qoxGbERuRkaz4/7@hEVe0ui5xQN1avUYNDBRwAYh0Db1U6sXE6esRoVJPoQZI1ijoEVRZEwNWqV@DX6UeMDTUoSrUgeGnh8/UGCTP6OO33w6u0Aa/S9XV62r06@pq6upiaupgTsEbpjX0iydi01MsAA "MATL – TIO Nexus") Or verify all test cases:
[1](https://tio.run/nexus/matl#@1@hFOFQaOgeqBYTpeSQZOhua68eo27qoxGbERuRkaz4/78pV7S6Lj6gbq1eo4AM0HjEyNsiA20UXg0VzMfv/lgA), 
[2](https://tio.run/nexus/matl#@1@hFOFQaOgeqBYTpeSQZOhua68eo27qoxGbERuRkaz4/78RV7S6rq6uurV6YlIykASxYwE),
[3](https://tio.run/nexus/matl#@1@hFOFQaOgeqBYTpeSQZOhua68eo27qoxGbERuRkaz4/7@hAVe0ui4IqFur1yhoK9QAaQg/FgA),
[4](https://tio.run/nexus/matl#@1@hFOFQaOgeqBYTpeSQZOhua68eo27qoxGbERuRkaz4/7@hEVe0ui5xQN1avUYNDBRwAYh0Db1U6sXE6esRoVJPoQZI1ijoEVRZEwNWqV@DX6UeMDTUoSrUgeGnh8/UGCTP6OO33w6u0Aa/S9XV62r06@pq6upiaupgTsEbpjX0iydi01MsAA),
[5](https://tio.run/nexus/matl#@1@hFOFQaOgeqBYTpeSQZOhua68eo27qoxGbERuRkaz4/78JV7S6Lnagbq1eo6sXnwDEClY1CjVWCvF6uurqQKIGJKWgoACSSgBLJYClgEJgKagBCSAhdXUgCRVAkgSq11MA4ngkGQWYBWAjoTZDTQTbC7IB4hKI1WBtuFwfCwA),
[6](https://tio.run/nexus/matl#@1@hFOFQaOgeqBYTpeSQZOhua68eo27qoxGbERuRkaz4/78pV7S6LipQt6aSSCwA),
[7](https://tio.run/nexus/matl#@1@hFOFQaOgeqBYTpeSQZOhua68eo27qoxGbERuRkaz4/78BV7S6LvFA3Vq9RktBAQnVKOMENSDVCijKaxRwgpqRYzZaoBIwW5lYAHE3sWBwmU1KGowFAA).
[Answer]
## JavaScript (ES6), 175 bytes
```
f=(s,l,p=++l,t=s.replace(/^-*|-*$/g,s=>s.replace(/-/g,(c,i)=>++i%l?c:`\\`)))=>t.search`
`<p?t:(f(s,l,p+l,t)+`
`+` `.repeat(p)).replace(eval(`/(^|(.*)\\n)(.{${p}})/g`),`
$3$2`)
;
test=(s,l)=>document.write(`<pre>${s}
${l}${f(s,l)}</pre>`);
test(`---
abc
---`,2);
test(`-----
| + |
-----`,10);
test(`---------------------------------------
|&&&&&&                         &&&&&&|
|&&&&&&                         &&&&&&|
|&&&&&&                         &&&&&&|
|&&&&&&          .\\^/.          &&&&&&|
|&&&&&&        . |   | .        &&&&&&|
|&&&&&&        |\\|   |/|        &&&&&&|
|&&&&&&     .--'       '--.     &&&&&&|
|&&&&&&      \\           /      &&&&&&|
|&&&&&&       >         <       &&&&&&|
|&&&&&&      '~|/~~|~~\\|~'      &&&&&&|
|&&&&&&            |            &&&&&&|
|&&&&&&                         &&&&&&|
|&&&&&&                         &&&&&&|
---------------------------------------`,12);
test(`-----------------------
|-._\`-._ :| |: _.-'_.-|
|   \`-._\`:| |:\`_.-'   |
|-------\`-' '-'-------|
|------_.-. .-._------|
|  _.-'_.:| |:._\`-._  |
|-'_.-'  :| |:  \`-._\`-|
-----------------------`,4);
test(`---------------
---------------
---------------
---------------
---------------`,5);
test(`-------------------------------------------
|*  *  *  *  * |##########################|
| *  *  *  *  *|                          |
|*  *  *  *  * |##########################|
| *  *  *  *  *|                          |
|*  *  *  *  * |##########################|
| *  *  *  *  *|                          |
|*  *  *  *  * |##########################|
|---------------                          |
|#########################################|
|                                         |
|#########################################|
|                                         |
|#########################################|
-------------------------------------------`,0);
```
I/O is as a newline-delimited string. Output includes a leading newline; this can be removed at a cost of 3 bytes. I tried computing the output string directly but that took me... 176 bytes:
```
f=
(a,l,h=a.length)=>[...Array(h+(a[0].length-1)/++l|0)].map((_,i)=>a[0].replace(/./g,(k,j)=>((k=i-(j/l|0))&&h+~k)|-~j%l?(a[k]||'')[j]||' ':'\\'))
;
test=(s,l)=>document.write(`<pre>${s}
${l}
${f(s.split`
`,l).join`
`}</pre>`);
test(`---
abc
---`,2);
test(`-----
| + |
-----`,10);
test(`---------------------------------------
|&&&&&&                         &&&&&&|
|&&&&&&                         &&&&&&|
|&&&&&&                         &&&&&&|
|&&&&&&          .\\^/.          &&&&&&|
|&&&&&&        . |   | .        &&&&&&|
|&&&&&&        |\\|   |/|        &&&&&&|
|&&&&&&     .--'       '--.     &&&&&&|
|&&&&&&      \\           /      &&&&&&|
|&&&&&&       >         <       &&&&&&|
|&&&&&&      '~|/~~|~~\\|~'      &&&&&&|
|&&&&&&            |            &&&&&&|
|&&&&&&                         &&&&&&|
|&&&&&&                         &&&&&&|
---------------------------------------`,12);
test(`-----------------------
|-._\`-._ :| |: _.-'_.-|
|   \`-._\`:| |:\`_.-'   |
|-------\`-' '-'-------|
|------_.-. .-._------|
|  _.-'_.:| |:._\`-._  |
|-'_.-'  :| |:  \`-._\`-|
-----------------------`,4);
test(`---------------
---------------
---------------
---------------
---------------`,5);
test(`-------------------------------------------
|*  *  *  *  * |##########################|
| *  *  *  *  *|                          |
|*  *  *  *  * |##########################|
| *  *  *  *  *|                          |
|*  *  *  *  * |##########################|
| *  *  *  *  *|                          |
|*  *  *  *  * |##########################|
|---------------                          |
|#########################################|
|                                         |
|#########################################|
|                                         |
|#########################################|
-------------------------------------------`,0);
```
I/O is as a string array.
[Answer]
# PHP, ~~168 164 187 172 167 153 150 152~~ 149 bytes
```
for($r=count($f=file(a));$y<$r+$e/$n=$argn;$y+=print"
")for($x=0;$x+1<$e=strlen($f[0])-1;)echo("\\".$f[$z=$y-($x/$n|0)][$x++]." ")[$z%($r-1)||$x%$n];
```
takes flag from static file `a` and wave length (minimum 1) from STDIN.  
Run as pipe with `php -nr` or [try it online](http://sandbox.onlinephpfunctions.com/code/c8b959d44edb1e02b0cc4b04b084b4bf07dd051f).
**breakdown**
```
for($r=count($f=file(a));       # import file, count lines
    $y<$r+$e/$n=$argn;          # loop $y through lines
    $y+=print"\n")                      # 2. print newline
    for($x=0;$x+1<$e=strlen($f[0])-1;)  # 1. loop $x through columns
    echo("\\".$f[                           # 3. create string=backslash+character+space
            $z=$y-($x/$n|0)                 # 1. line no. = $y - wave offset
        ][$x++]." "                         # 2. pick character from line
        )
    [
        $z%($r-1)                           # if not first or last line
        ||$x%$n                             # or not last position of wave
    ]                                       # then index 1 (character or space), else "\\"
    ;
```
]