Skip to content

Tag: linux

capturing words between double quotes in awk

I’m trying to print the name of my Linux distribution. The output of cat /etc/os-release for my distro is: Now I want to grab the Arch Linux from the second line. I used this command: But this prints PRETTY_NAME=”Arch How can I grab the words (including space) from this line? Answer Setting the fi…

Create filename based on file output in shell

I’m looking to create files with names based on the command output of the previous command i.e. if i run So that the output of the amount of files of that type is the filename of the created file. Answer Here’s a solution that renames the file after it has been created: What is happening in this o…

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 b…

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 &…