Accessing file, and manipulating with with folders
Hi!
I need help. I have a .csv file with a list of Drugs Name that i need to remove from the folder. The folder consist of files that stored as drugname.mol format. What i need to do is to sieve out those mol files from the folder? How do i (1) access the drugs names from the .csv file line by line (variable x) (2) how do i access the files in the folder one by one (variable y) (3) how can i do a comparison whether $x.mol == $y (4) and shift them to another folder if $x.mol == $y Hope u understand my questions, and thanks very much for the help. |
This may be a better question for the Programming forums as it sounds like you want to write a shell script. It does sound like it may be a simple shell script, something similar to this:
Code:
#!/bin/bash |
Accessing file, and manipulating with with folders
Hi!
I need help. I have a .csv file with a list of Drugs Name that i need to remove from the folder. The folder consist of files that stored as drugname.mol format. What i need to do is to sieve out those mol files from the folder? How do i (1) access the drugs names from the .csv file line by line (variable x) (2) how do i access the files in the folder one by one (variable y) (3) how can i do a comparison whether $x.mol == $y (4) and shift them to another folder if $x.mol == $y is there any simple unix scripting that can be used? or maybe C, C++ or perl? Hope u understand my questions, and thanks very much for the help. |
Sorry I just reread this code and it does a call to $y but $y has not been defined. Here is an update
Code:
#!/bin/bash |
What is in the csv file ? Is it just one column ? If so, you can just use a while read line loop and remove those that are not in the folder, or rather move the ones that you want into a different folder.
bash should work, unless you want something else. |
What about:
Code:
$ sudo rm -irf *.mol |
Hi adamelody
My first question is what have you tried? If you need a direction I would suggest looking into tutorial pages on bash and / or awk. If you have tried something and are stuck, then let us know where? Otherwise it might be miscontrued that this is homework or an assignment you would like us to do for you :( |
thanks!!!! its solved!
|
No problem. Glad I could help you
|
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
|
I've merged your two duplicate threads---One thread per topic, pleas
|
Thanks. I have managed to solve it. manipulating files was alright, but i have no idea how to "move" the files.
Thanks for your help anyway! Quote:
|
All times are GMT -5. The time now is 11:30 PM. |