I have a program that needs to access a file. The content of this file is in a variable and I want to avoid creating a real file. Is it possible to create some kind of virtual file?? Normally I would pipe this to the command, but STDIN already “in use”. Is there any way to pass both variables to
Tag: shell
How to extract names of compound present in sub files?
I have a list of 15000 compound names (file name: uniq-compounds) which contains names of 15000 folder. the folder have sub files i.e. out.pdbqt which contains names of compound in 3rd Row. (Name = 1-tert-butyl-5-oxo-N-[2-(3-pyridinyl)ethyl]-3-pyrrolidinecarboxamide). I want to extract all those 15000 names by providing uniq-compound file (it contain folder names e.g ligand_*) out of 50,000 folder. directory and subfiles
Bash loop only read the last line
I have problems trying to extract data behind colons in multiple lines using while loop and awk. This is my data structure: What I want to get is the BioSample ID, which is like SAMD00019077. Scripts I tried: while read line ; do echo $line | awk -F’:’ ‘{print $3}’ > 1.tmp2 ; done < 1.tmp for line incat 1.tmp;
[[ operator fails with error “conditional binary operator expected”
Linux bash script fails for the following line. Error message as given. I know i can simply use if [ -f file1.txt ] but curious to know what needs to be fixed to make this working. conditional binary operator expected expected `)’ Answer The mv command shouldn’t be inside the conditional expression, it’s a command that you want to execute
How to split file based on first character in Linux shell
I do have a fixedwidth flatfile with the header and detail data. Both of them can be recognized by the first character: 1 for header and 2 for detail. I want to genrate 2 different files from my fixedwidth file , each file having it’s own record set, but without type record written. File Header.txt having only type 1 records.
linux find command: exclude path from result
I used the find command to find all python files in a folder, and exlude some folder. find . -type d ( -path ./venv -o -path ./virtualenv -o -path ./lib ) -prune -o -iname ‘*.py’ It’s give the following output: How can I tweak the find command to exclude ./venv in the resultset? Answer If you don’t specify any actions,
I want to extract any text between two symbol
I need to execute the file (a.out) and at the same time, I just need specific parts of the output, not everything. which is either located between these two string [[….]] or ((…..)). and I don’t have any idea where the other text is located (there is no specific pattern) and how the output looks like? for example: if I
“Cache” credentials on a bash script
I have created a bash script to run a few js scripts into MongoDB. Basically, what I am doing is, running the bash script and passing a parameter in this case called version, example: That will go and execute all scripts for the version 1.0. Now, it is possible that MongoDB requires authentication user/pass, so I have an option in
How to include path inside bashrc in linux for envirnment
Im testing my code for automation of the installation of a software In bashrc file below: Here im trying to add $SCALA_HOME/bin to PATH. this is the required output: the above code worked to append SCALA_HOME above path but for appending in the same line im not able to do please help me get the correct sed command to append
How can I automate the user creation in Linux servers using Python
Well I’m trying to create a script to automate the user creation in Linux servers, so I generated the ssh keys in each server and made a code like this: But, I’m getting the error: When I remove ssh myuser@lab part, the script work in the localhost. Could someone help me with this issue? Answer You are treating ssh as