Take all text from a txt file but skip the first line?

zmike

Client
Регистрация
24.10.2019
Сообщения
133
Благодарностей
8
Баллы
18
Hi Zenno friends,

I am trying to process a txt file, in which contain the article title in the first line, and the article content in the other lines.

Here is what I tried so far:

First, Get the article by using Read file > Take Text > save into {-Variable.article-}
Next, Save the {-Variable.article-} into a list.
Finally, Get line and use By number, where I entered 1-end, trying to get all lines except the 0 line, which is the title.

However, it seems that I have done something wrong, the 1-end is not working.
ZP7 only read the number 1.
I tried to put the word "end" under "By Number", it works, it does get the last line.
I also tried to put random, it works too.

Any help would be appreciated!

Plus, is there any way to "Get line" directly from a txt file?




48372


48373
 

zmike

Client
Регистрация
24.10.2019
Сообщения
133
Благодарностей
8
Баллы
18
Get Line will only work with 1 line?
 

orka13

Client
Регистрация
07.05.2015
Сообщения
2 177
Благодарностей
2 184
Баллы
113
Get Line will only work with 1 line?
yes. use another algorithm:
1. Delete 1st line from list.
2. "Merge list items"

Or use this C# code to read file skipping first line. But first create variable Path with path to file (C:\text.txt) and variable without1 (code will save text in it):
C#:
IEnumerable<string> strings = File.ReadLines(project.Variables["Path"].Value).Skip(1);
string joinedString = string.Join("\r\n", strings);
project.Variables["without1"].Value = joinedString;
 
Последнее редактирование:
  • Спасибо
Реакции: zmike

zmike

Client
Регистрация
24.10.2019
Сообщения
133
Благодарностей
8
Баллы
18
Thank you orka13

It works like a charm!
I create path and without1 variable, and setup a default value for path.
The code below output my text content without the first line.


48390


48389
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)