Biostar Beta. Not for public use.
Is it possible to append in first line of my output.txt the name of folder? (in this case PDB code)
1
Entering edit mode
2.6 years ago
cc • 20

I have different folder :

1a4z 1b5a 3f4a

I run a script that analyze all my folders in a single file txt, the problem is : doesn't appear the name of the folder so I don't know when the script ends to analyzes a folder and start to analyze the next folder I would like output where appears the name of folder like this:

1a4z some data 1b5a some data 3f4a some data

many thanks!!

1
Entering edit mode

We need to see the script to help you, but it can be as simple as this (lets assume you’re looping over each directory):

for dir in $(ls parent_dir); do echo “${dir}:”
# analysis from your script and all output
done

0
Entering edit mode

Your problem description is not clear. Let us know if the following is correct.

You have folders like this

1a4z
1b5a
3f4a


You are doing some analysis and you want to the results to end up in those individual folders (e.g. result is the output)?

1a4z/result
1b5a/result
3f4a/result


or you want the result files to be named

1a4z_result
1b5a_result
3f4a_result

0
Entering edit mode

I have a script that analyze this folders and output of this script is a single text file, like ATOM THR 244

ATOM TRP 177

ATOM GLU 476

ATOM GLU 268

ATOM THR 244

ATOM GLU 476

ATOM GLU 268

I would like output like this:

1a4z:

ATOM THR 244

ATOM TRP 177

ATOM GLU 476

ATOM GLU 268

1b5a :

ATOM THR 244

ATOM GLU 476

3f4a:

ATOM GLU 268

1
Entering edit mode

can you proivde the (relevant) parts of code of your script?

perhaps it's as easy as doing cd to the correct output folder?

Please use ADD COMMENT/ADD REPLY when responding to existing posts to keep threads logically organized.