-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcleanParams.notes
More file actions
40 lines (30 loc) · 1.13 KB
/
cleanParams.notes
File metadata and controls
40 lines (30 loc) · 1.13 KB
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
FILE=$1
DATA=$(cat $FILE | grep "=" | grep -v ".jpg\|.png\|.css\|.js" | uniq)
# need to find each unique param line
# if new param is found, keep it. If not, remove itC:q
# | sed -e 's#.*=\(\)#\1#'
#
# http://banner.finn.no/finn/car/used/result/feed.atom?
# YEAR_MODEL_FROM=1953&YEAR_MODEL_TO=1970&keyword=volkswagen" | sed -e 's#.*=\(\)#\1#'
# -> volkswagen
# Last value for "?"
# cut -d "?" -f2
#
# echo "http://banner.finn.no/finn/car/used/result/feed.atom?
# YEAR_MODEL_FROM=1953&YEAR_MODEL_TO=1970&keyword=volkswagen" | cut -d "?" -f2
# -> YEAR_MODEL_FROM=1953&YEAR_MODEL_TO=1970&keyword=volkswagen
# Use this to get all parameters
# Then extract each param
# then create insertion?
# Last value for "="
# cut -d "=" -f2
#
# echo "http://banner.finn.no/finn/car/used/result/feed.atom?
# YEAR_MODEL_FROM=1953&YEAR_MODEL_TO=1970&keyword=volkswagen" | cut -d "=" -f2
# -> 1953&YEAR_MODEL_TO
# All values after first "="
# cut -d "=" -f2-
# echo "http://banner.finn.no/finn/car/used/result/feed.atom?YEAR_MODEL_FROM=1953&
# YEAR_MODEL_TO=1970&keyword=volkswagen" | cut -d "=" -f2-
# -> 1953&YEAR_MODEL_TO=1970&keyword=volkswagen