To write the name of files in a directory to a text file.
for f in *; do echo $f >> filename.txt; done;
To extract specific lines from a file
sed -n 16224,16482p filename > newfile
To cut specific columns from a file and output them with a space (” “) in another
file
awk ‘{print $2″ “$3}’ pca_efz_3138k > pca_efz_e138k_modes
To separate molecules from a file containing multiple molecules (in this case pdbqt files)
csplit -k -s -n 3 -f idock idock_1000hits.pdbqt ‘/^ENDMDL/+1’ ‘{‘998′}’
here the file containing multiple pdbqt molecule is “idock_1000hits.pdbqt” and the pattern for splitting is line starting with ENDMDL. ‘{‘998′}’ repeats the pattern 998 times.
To remove the MODEL and ENDMOLDE from pdbqt files so that it can be used with vina
for f in idockhits*; do cat $f | egrep -v ‘^MODEL’ | egrep -v ‘^ENDMDL’ > test$f; done