Created
October 4, 2016 09:35
-
-
Save krassowski/464120af1fe50e312d5e676920eaf575 to your computer and use it in GitHub Desktop.
Bash shell answers for "Molecular modelling and computational biology 1"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Create a directory with your name on your desktop | |
mkdir ~/Desktop/Michal | |
# 2. Download a directory XYZ located in /home/login/somedir from login@host to your created directory | |
cd ~/Desktop/Michal | |
scp -r login@host:~/somedir/XYZ . # often you can skip '~/' after the colon - remote directories defaults to user's home | |
# 3. Merge files a.pdb with b.pdb, in this order, and save the result to c.pdb | |
cd XYZ | |
cat a.pdb b.pdb > c.pdb | |
# 4. Replace 'X' occurrences in lines 100-200 with 'Y' in the c.pdb file | |
sed -ie '100,200s/X/Y/g' c.pdb # the simplest way | |
# echo "$(sed -e '100,200s/X/Y/g' c.pdb)" > c.pdb # do this in a subshell | |
# sed -e '100,200s/X/Y/g' c.pdb > c_new.pdb; mv c_new.pdb > c.pdb # no way to forget this | |
# 5. Remove lines 100-101 from the c.pdb file | |
sed -ie '100,101d' c.pdb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment