-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdel_MOPAC_header.sh
executable file
·38 lines (29 loc) · 1023 Bytes
/
del_MOPAC_header.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# **************************************************************************
# ..........................................................................
# Delete the MOPAC header
# ..........................................................................
# **************************************************************************
# ACTION:
# - Delete MOPAC header of '.arc' files
# REQUIRES:
# - 'opt.arc' files
# -----------------------------------------------
# ADJUST:
# - None
# -----------------------------------------------
# CALLING SEQUENCE:
# $ ./del_MOPAC_header.sh <.arc>
inp=$1
# Remove all 'WARNING' lines
grep -i -v -w "warning" $inp > tmp.dat
mv tmp.dat $inp
echo Writing ${inp}
# Removing the MOPAC header.
# 1) Determining header length: $lenHead.
# 2) Determining total length: $lenTot.
# <tr -s>: squeezing multiple white space.
lenHead=`grep -n "FINAL GEOMETRY" $inp|cut -d ":" -f 1`
lenTot=`cat $inp|wc -l`
tail -n -$((lenTot-lenHead)) $inp > ./tmp.dat
mv ./tmp.dat $inp