Splitting text file into multiple files
I have a text file that is filled with references to duplicate files.
I'm trying to create a text file for each duplicate file found that contains the paths to the duplicates. I would also like the text file names to be based on the size and file name. Some thing like: 231.5 KB - P&S.doc.txt 138.5 KB - LIMITED#C71.doc.txt If someone could point me in the right direction I would greatly appreciate it. Code:
Name Path Size Last Change Last Access File Type Owner Attributes |
Do you have any previous programming experience? The problem you asked could be rather easily solved in any number of languages. I would go for python (or perl, if you prefer. Or even Bash, if you're strangely masochistic)
And I assume that that was an extract you posted, rather than the whole file, or it would be far far quicker to just do it by hand ;) |
I do have some programming experience. I'm familiar with C,C++,VB 6, PHP, ASP, COBOL...but I haven't coded in a while. I have taken a look at phython in the past.
And you are correct, that is only a partial sample of the file in question. The files is a 50 MB text file. |
A good job for awk. Example:
Code:
BEGIN { |
Colucix, thanks for the link.
The text you provided, is it a filter for awk? I think I see how it is used: Code:
awk -f (your file) input_file |
Quote:
Quote:
awk is a very powerful tool to parse and extract information from text files. However if you want to learn or refresh a new language, python is more complete since - as you already know - it offers a huge collection of libraries for a large variety of tasks. Anyway, normally you don't need to develop complicate awk programs but you can consider it as a handy command line utility, so that you can limit your learning process to the basics. |
All times are GMT -5. The time now is 12:57 AM. |