Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Как выбрать строки из txt файлов с определенным вхождением?

 
Post new topic   Reply to topic    Total Commander Forum Index -> Общие вопросы printer-friendly view
View previous topic :: View next topic  
Author Message
evshi



Joined: 30 Mar 2009
Posts: 11

Post (Separately) Posted: Wed Jun 10, 2009 09:40    Post subject: Как выбрать строки из txt файлов с определенным вхождением? Reply with quote

В папке лежит много текстовых файлов. Надо выбрать из них все строки (в буфер или в другой файл), где встречается заданная последовательность символов.

Как это можно реализовать в TC?
Back to top
View user's profile Send private message
D1P



Joined: 20 Dec 2004
Posts: 2973
Location: Тбилиси

Post (Separately) Posted: Wed Jun 10, 2009 10:04    Post subject: Reply with quote

TC - не текстовый редактор, %username%.
Найти файлы с заданной последовательностью нескложно, но копирование части их содержимого - не задача файлового менеджера.
_________________
База знаний о Total Commander
Блог
Back to top
View user's profile Send private message
Tol!k



Joined: 01 Apr 2008
Posts: 1727
Location: Арзамас

Post (Separately) Posted: Wed Jun 10, 2009 19:46    Post subject: Reply with quote

evshi
cmd.exe /c find /i "последовательность символов" *.txt > out.list
подробности: cmd.exe /k find /?
Back to top
View user's profile Send private message
Zoooom



Joined: 28 Dec 2004
Posts: 45

Post (Separately) Posted: Fri Jun 12, 2009 16:25    Post subject: Reply with quote

cat *.txt | grep 'много буков' > savefile.txt


---------------
ЗЫ поставьте себе комплект unxutils и решайте задачи типа "взять из всех текстовых файлов последние 10 строк, содержащих A и не содержащих B, сведя в общий список и отсортировав" одной командой
Back to top
View user's profile Send private message
Kent



Joined: 14 Dec 2004
Posts: 208

Post (Separately) Posted: Sat Jun 13, 2009 00:10    Post subject: Reply with quote

Zoooom wrote:
cat *.txt | grep 'много буков' > savefile.txt
Типичная ошибка.
Всё гораздо проще:
grep 'много буков' *.txt > savefile.txt
Back to top
View user's profile Send private message
evshi



Joined: 30 Mar 2009
Posts: 11

Post (Separately) Posted: Mon Jun 15, 2009 11:40    Post subject: Reply with quote

Tol!k wrote:
evshi
cmd.exe /c find /i "последовательность символов" *.txt > out.list
подробности: cmd.exe /k find /?


Спасибо, это то что надо.

Единственное - можно ли, чтобы в out.list не писались бы имена файлов, откуда извлечены строки?
Back to top
View user's profile Send private message
Tol!k



Joined: 01 Apr 2008
Posts: 1727
Location: Арзамас

Post (Separately) Posted: Mon Jun 15, 2009 13:44    Post subject: Reply with quote

Code:
cmd.exe /c find /i "последовательность символов" *.txt | find /v "---------- " > out.list

Последовательность "---------- " так найти не получится ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Общие вопросы All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group