-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathripname
More file actions
executable file
·16 lines (15 loc) · 799 Bytes
/
Copy pathripname
File metadata and controls
executable file
·16 lines (15 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/csh
# ripname (csh script) -- find the recipient in a message on stdin
awk '/^From:/ { apostrophe_index = index( $0, "'\''" ) \
if (apostrophe_index > 0) \
name = substr( $0, apostrophe_index + 1, length( $0 ) - apostrophe_index - 2 ) \
else \
{ \
lt_index = index( $0, "<" ) - 8 \
if (lt_index > 0) \
name = substr( $0, 7, lt_index ) \
else \
name = substr( $0, 7, 100 ) \
} \
print name \
}'