using System;
public class Test
{
public static void Main()
{
string[] linhas = { "N0006 G90", "N0007 G90", "N0008 G92 X21.7301 Y88.9657",
"N0009 S555", "N0010 D14", "N0011 G42 G01 X22.0659 Y89.3015",
"N0012 X22.4194 Y89.655", "N0013 (PATHSTART0)",
"N50000 G43 G017 X22O.0659 Y89.3015" };
int contador = 0;
foreach(string linha in linhas) {
int espaco = linha.IndexOf(" "); // Quantidade de caracteres antes do espaço
contador++;
// Retorna os caracteres a partir do primeiro espaço
string linhaIndexada = "N" + contador + linha.Substring(espaco);
Console.WriteLine(linhaIndexada);
}
}
}
dXNpbmcgU3lzdGVtOwoKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoJCXN0cmluZ1tdIGxpbmhhcyA9IHsgIk4wMDA2IEc5MCIsICJOMDAwNyBHOTAiLCAiTjAwMDggRzkyIFgyMS43MzAxIFk4OC45NjU3IiwKCQkgICAgICAgICAgICAgICAgICAgICJOMDAwOSBTNTU1IiwgIk4wMDEwIEQxNCIsICJOMDAxMSBHNDIgRzAxIFgyMi4wNjU5IFk4OS4zMDE1IiwKCQkgICAgICAgICAgICAgICAgICAgICJOMDAxMiBYMjIuNDE5NCBZODkuNjU1IiwgIk4wMDEzIChQQVRIU1RBUlQwKSIsCgkJICAgICAgICAgICAgICAgICAgICAiTjUwMDAwIEc0MyBHMDE3IFgyMk8uMDY1OSBZODkuMzAxNSIgfTsKCQkgIAoJCWludCBjb250YWRvciA9IDA7CgkJCgkJZm9yZWFjaChzdHJpbmcgbGluaGEgaW4gbGluaGFzKSB7CgkJCWludCBlc3BhY28gPSBsaW5oYS5JbmRleE9mKCIgIik7IC8vIFF1YW50aWRhZGUgZGUgY2FyYWN0ZXJlcyBhbnRlcyBkbyBlc3Bhw6dvCgkJCWNvbnRhZG9yKys7CgkJCQkKCQkJLy8gUmV0b3JuYSBvcyBjYXJhY3RlcmVzIGEgcGFydGlyIGRvIHByaW1laXJvIGVzcGHDp28KCQkJc3RyaW5nIGxpbmhhSW5kZXhhZGEgPSAiTiIgKyBjb250YWRvciArIGxpbmhhLlN1YnN0cmluZyhlc3BhY28pOyAKCQkJQ29uc29sZS5Xcml0ZUxpbmUobGluaGFJbmRleGFkYSk7CgkJfQoJfQp9