I've been running some analyses, the results of which have been stored in a sequential manner with a directory structure like step0, step1, step2, ... for iterations 0-2, for example. Each iteration contains several nested folders, with three pieces of information I need. I need to do the following:
(1) Find within each iteration directory, and extract sequentially to a new file, the number following the text, "final GAMMA-based Likelihood:" The numbers need to be in a list whose order preserves the original order (iteration 0, 1, 2, ...).
(2) Find, copy, and concatenate into a single file the contents of the file "RAxML_bestTree.default." As for (1), the order should preserve the iteration order.
(3) Copy the file "input.phy" to a new directory called alignments, preserving the order of the iterations, and renaming the file to correspond to the iteration number, e.g. input.phy.0, inpout.phy.1, etc.
I anticipate this will require some grep and for loops, but I am very much unsure of how to proceed.
A. directories should be nested like the following?
where information is actually stored in an unspecified number of files inside each step<N>subdir<M> directory; can we assume the files are ordered by filename in the order the information is to be searched and (if found) retrieved?
If this is the case, the command to list the files paths, keeping at the same time the alphabetical order of subdirs and filenames:
The output of the command should resemble something like this:
You see that the alphanumerical order is kept.
You may redirect the output of the above command to a file in order to keep it for reference during the current search and extraction job:
I think this is the core of your task, having an alphanumerically ordered list of files.
B. once you have the alphabetically ordered list you may start to look for the entries "final GAMMA-based Likelihood:" in the files:
C. similar concept for your (2) bullet element:
D. for bullet (3) task, you should be able to do it by yourself at this point =)
I have been thinking how to address this particular task but is way beyond my knowledge.
I have a reference sequence, something like this:
>Reference
AGAGAGACCTGGAGAGAGAGTGACGATGAGCAGTGACGATGACGTACGATAGCAGTAGACGCA
and a input.txt file with thousand of short sequences, something like this
... (4 Replies)
Dear All,
I have a situation where I want to copy some files of type .txt.
These files are o/p from one program. Some of the files are named as
fileName .txt instead of fileName.txt
after fileName by mistake I have specified "space". Now I want to move these files as follows.
mv fileName*... (13 Replies)
Hi, I have a below challenging task where iam unable to find the block and copy the same into a file.
I tried my luck,howver iam unable to reach the first and second step..Can anyone help me with a clue or with the commands so that i can give a try.
1. search the <number>9966993366</number>... (2 Replies)
Hello all.
I'm scripting in ksh and trying to put together a regular expression. I think my logic is sound, but I'm doing the head-against-the-wall routine while trying to put the individual pieces together. Can anybody lend some suggestions to the below problem?
I'm taking a date in the... (2 Replies)
Hi everyone. I'm trying to help my wife with a project, she has exported 200 images from many different folders, unfortunately there was a problem with the export and I need to find the master versions so that she doesn't have to go through and select them again.
I need to:
For each image in... (2 Replies)
Hello :)
can someone please help me with this task:
I am in the shell, in folder "Main"
below the folder Main are sub folders: "sourceA", "Source B", and "target"
in sourceA and source B are files, and in folder "Main" is a textfile, with filenames, one filename per line.
I need a... (4 Replies)
I have to create a bash script that will find Feedback emails and copy them to a labFeedback folder in my mail directory. I have an idea in my head on what commands can be used for this (find obviously among them). However, I have no idea where to start. I'm not sure what info needs to be given,... (1 Reply)
I am trying to figure out how to write a bash script to process a file in order to make it more user readable. The file to be processed is quite uniform, every line starts with a 32 bit Unix timestamp in hexadecimal format, then a single tab charcter (0x09) then a string of text.
What I want to... (1 Reply)
Hi all,
I have a folder '/samplefolder' in which i have some files like data0.txt, data1.txt and data2.txt.
I have to search the folder for existence of the file data0.txt first and if found have to copy it to some other file; next i have to search the folder for existence of file... (5 Replies)
Hi ,
I have a question relating to finding and copying files.
i need to find the .pdf files from the specified directory which has subdirectories too. I only need .pdf files and not the directories and need to copy those files into my current directory.
copy files from :... (5 Replies)