-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultipart.awk
executable file
·58 lines (50 loc) · 917 Bytes
/
multipart.awk
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
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/awk
BEGIN{
#{{{
# name="name"
# Orders
# name="body"
# Orders subject to approval.
# name="image";filename="temp.txt"
# Content-Type: text/plain
#}}}
tmpfile="png.tmpfileout"
}
{
if(PROC =="getformfields"){ #PROC
if($0 ~ "Content-Disposition:"){
NEWREC=NR
sub(".*form-data; name=", "")
gsub(/"/, "")
# field=$0 #$1$2$34
print #CNT, CNT%2, field;
# CNT++
}
if(NEWREC>0 && NR > NEWREC+1 && NR < NEWREC+3){
# value=$0
print #CNT, CNT%2, value
# CNT++
}
if($0 ~ "Content-Type:"){
print #CNT, $0
# CNT++
NEWFILE=NR
}
}else if(PROC =="getContentType"){ #PROC
if($0 ~ "Content-Type:"){
print #CNT, $0
# CNT++
NEWFILE=NR
}
}
else if(PROC == "getfiledata"){
if($0 ~ "Content-Type:"){
# print #CNT, $0
# CNT++
NEWFILE=NR
}
if(NEWFILE>0 && NR >NEWFILE+1 && !($0 ~"------"))
print
#>tmpfile
} #PROC
}