forked from benlk/sadface
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsed-cleaning.sh
More file actions
executable file
·49 lines (43 loc) · 950 Bytes
/
Copy pathsed-cleaning.sh
File metadata and controls
executable file
·49 lines (43 loc) · 950 Bytes
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
39
40
41
42
43
44
45
46
47
#!/bin/bash
#
# uses args $1 $2 $3
# usage:-$ sed-cleaning.sh inputfile temporaryfile outputfile
# file read/write is 1->3->2->3
# Get rid of unicode crap
cat $1 | tr "\r\n" "\n" | tr -s "\n\n" "\n" | tr -s " " " " > $3 # All hail http://www.unix.com/41858-post5.html
sort -u $3 -o $2
# run this with sed -nf sed-cleaning file.txt
sed -e 's/Mr\. /Mr /g
s/Mrs\. /Mrs /g
s/Dr\. /Dr /g
s/- - -\n//g
s/----------------------------------------------------------\n//g
s/----------------------------------------\n//g
s/-----\n//g
s/--\n//g
s/~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-\n//g
s/#\n//g
s/\///g
s/> \n//g
s/\x0A//g
s/\x02//g
s/\x03//g
s/\n\n/\n/g
s/\n \n/\n/g
s/\.\n/\. /g
s/\n/ /g
s/\n /\n/g
s/\n /\n/g
s/\n /\n/g
s/\n /\n/g
s/\. /\. /g
s/\. \. \./\.\.\./g
s/ \./\./g
s/"//g
s/\. /\.\n/g
s/_//g
s/Dr /Dr\. /g
s/Mrs /Mrs\. /g
s/Mrs\.\. /Mrs\. /g
s/Mr /Mr\. /g
s/Mr\.\. /Mr\. /g' <$2 >$3