Program that will search specific numbers from inside a txt,cut them,and ask me to put the name of the folder to put them in

Can't Post

So the whole idea is about a program that will search inside the txt i will give whatever number starts with _ (Example : _10165,_09957 ),and with the results it will search the directory wich i give.Example C:\Id Boxes and tell me wich of the numbers that searched from the txt are not found in this folder as archives (other .txts).Then cut those that found and ask me to create a folder with them.

I have attached a copy of how exactly the txt looks.In this txt there are the numbers that the program will "see" and perfrom the opperation i said before. Unless there is a program out there in the internet space wich already does it??

For further details please,question me! Any help,comments,ideas would be much appreciated

Re: [alogoc] Program that will search specific numbers from inside a txt,cut them,and ask me to put the name of the folder to put them in
[In reply to]

Can't Post

First of all where have you attached " I have attached a copy of how exactly the txt looks." Whenever you are posting some thing to PerlGuru you are supposed to attach the attachments to your posts in this forum only I suspect that you have attached the textfile to some other post/ mail. I cannot see it here.

Next as far as I can understand you are looking to search for some text in a text file (and remember them; in may be some temporary array) and then selecting everything except the contents of that array in another file.

See that directory thing is nothing; while giving filenames just you have to give the path of your files if they are in a different directory that's all.

On the very basic you mean to search for something and then search for every thing except that thing

If you say Yes then we can proceed -For all my suggestions " I am sure someone else can do it in a better or elegant manner!"

Re: [vikas.deep] Program that will search specific numbers from inside a txt,cut them,and ask me to put the name of the folder to put them in
[In reply to]

Can't Post

Sorry!I didn't notice it wasn't uploaded!It's up now!

The txt as you will see is in lines,every line has a number that starts with _(5 numbers follow).That number is an archive (a .txt) in another directory.What i want,is to search in that directory and find those archives.Then move them to folder wich i will name.It's imporant to tell me wich archives are not found...

Re: [vikas.deep] Program that will search specific numbers from inside a txt,cut them,and ask me to put the name of the folder to put them in
[In reply to]

Can't Post

First of all,thanks for answering my question.

Well on the file :C\Id Boxes image that there are like 10 thousand files.Their names are like this : "IM1905091047_1_03521.txt" And yes an output folder were the .txts will be moved.It would be nice if the program would create a folder,so i type the name,and move them in. As you notice the whole scene is about to organise those 10 thousand .txts and put them into folders.

About the search in the C:\Id Boxes now.The "IM1905091047" except the IM,is day,month,year,time and minutes wich the txt was created,and it's named that way.Here is the reason why the program much search with the "_" in front:

Let's say in this case we want to search for 1047,there is this .txt right here "IM1905091047_1_03521" and this txt right here "IM1905091047_1_10231". The search will bring both the archives,and we do not want that smiley

That's why there is the "_" there.The program will search for the _1047.Exaclty as it's reffered in the attached .txt i sent you.

By the way there is a great chance to be dublicated files there,so a report would be nice

Re: [alogoc] Program that will search specific numbers from inside a txt,cut them,and ask me to put the name of the folder to put them in
[In reply to]

Can't Post

I do not know how to create folders using perl script. I can help with searching in a text file but creating a separate folder and then moving all the files (matched or not) in that folder is beyond my knowledge.

Quote

-For all my suggestions " I am sure someone else can do it in a better or elegant manner!"

Re: [vikas.deep] Program that will search specific numbers from inside a txt,cut them,and ask me to put the name of the folder to put them in
[In reply to]

Can't Post

In Reply To

I do not know how to create folders using perl script. I can help with searching in a text file but creating a separate folder and then moving all the files (matched or not) in that folder is beyond my knowledge.

Quote

mkdir() <--- makes a folder

File::Path <-- creating or deleting directory trees

File::Copy <-- moving or copying files to other folders -------------------------------------------------

Re: [KevinR] Program that will search specific numbers from inside a txt,cut them,and ask me to put the name of the folder to put them in
[In reply to]

Can't Post

Hey These appear to be simple linux commands. At least now (If not for anything else but as a token of respect to your post) when you have come up with that I should and (I shall) spent sometime over it. May be tonight itself (even though I am not an insomniac .)

Quote

-For all my suggestions " I am sure someone else can do it in a better or elegant manner!"

Re: [vikas.deep] Program that will search specific numbers from inside a txt,cut them,and ask me to put the name of the folder to put them in
[In reply to]

Can't Post

In Reply To

Hey These appear to be simple linux commands. At least now (If not for anything else but as a token of respect to your post) when you have come up with that I should and (I shall) spent sometime over it. May be tonight itself (even though I am not an insomniac .)

Quote

A lot of perl is derived from Unix so there is a lot of similarity. -------------------------------------------------

Re: [FishMonger] Program that will search specific numbers from inside a txt,cut them,and ask me to put the name of the folder to put them in
[In reply to]

Can't Post

After the person who originally posted the problem lost interest in this thread and I admitted of my lack of knowledge; I thought the thread is dead but for two gentleman who rekindled fire over here.

I went back to my reference manual and realized that there are not one or two but at least a dozen modules for all sort of file operations

I have selected two of them (one of them is same as suggested by Kevin, who had in fact suggested two modules.)

The problem is not solved. I have subdivided it into three problems

(1) There is a text file with complete names of files and the user only enters dates/ incomplete names to search for those files. The script has to search for all the files having that date/ incomplete name. This part is done.

(2)The script has to search in a directory all the files that matched user entered dates. This is where problem arises

(3) Move the files(matched or unmatched whatever desired) to a new folder. This can also be done