Take a part of a line

kendy

Новичок
Регистрация
06.05.2011
Сообщения
18
Благодарностей
0
Баллы
0
Hi friends ;-) i have a text file with hundred and hundreds lines, and i would like to take only the first 10 words of these lines. I know how to take the full line, but i don't know how to take only the first 10 words. Do you know how i can do it ? Thanks you very much for your help ^_^
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
831
Баллы
113
put the separator after every 10 words like |
than you can handle it by using String.Split
 
  • Спасибо
Реакции: kendy

gcomm

Client
Регистрация
01.03.2011
Сообщения
332
Благодарностей
93
Баллы
28
regex the string ----> word/numeric \ whitespace X 10 words. <-- rudimentary version :cool:


Someone will know the exact regex....
 
  • Спасибо
Реакции: kendy

kendy

Новичок
Регистрация
06.05.2011
Сообщения
18
Благодарностей
0
Баллы
0
Thanks for your replies men ;-)

I will wash my brains and try the gcomm answer
 

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
Here's a JS solution for you. Took me a little while but it gives you what you want without having to put anything in your file.

Посмотреть вложение Get10Words.xml

You'll have to replace the name of your file in the first step branch macro.
 
  • Спасибо
Реакции: kendy

joma

Client
Регистрация
06.03.2011
Сообщения
107
Благодарностей
13
Баллы
0
^(\w+\b.*?){10}
 

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