Answer the question
In order to leave comments, you need to log in
How to display certain words according to a given rule from a .txt document?
There is a folder with .txt documents. Each document has a line like this:
Mass x
where x is a number, and this number is different in each document. We need a program that will process all text files in a folder and display the result in the form:
Bolt mass 100
Nut mass 50
Bolt, nut are the names of text documents that need to be displayed. Next comes the weight value, which was displayed in the corresponding document.
Answer the question
In order to leave comments, you need to log in
www.powergrep.com is a universal soldier
, however, I tried a couple of times to link with file names, and I didn’t find how to do it
because - first combine all the files into one, here are the ways: www.fullstuffing.com/2011/01/ txt.html
(I recommend TXTcollector, it will write the names of the source files in the result),
and then extract the data with a grep
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question