I am trying to remove this :
2012-04-04 07:51:04 (2012-04-04 11:51:04.399000000Z): subject=PROD.
from the following
2012-04-04 07:51:04 (2012-04-04 11:51:04.399000000Z): subject=PROD.sdmp.o.t.0.0.0.0.NewOrderExecutionOE.?.4366.0.2.3.1.TNP.FIDESSA.IBAPPBAL504.EQUITY, message={PL=[10 3 49 46 51 18 3 84 78 80 26 7 70 73 68 69 83 83 65 34 37 79 69 45 50 48 49 50 48 52 48 52 45 48 48 48 48 52 54 55 55 52 48 50 84 82 83 70 49 46 49 46 49 45 48 48 50 49 42 19 78 101 119 79 114 100 101 114 69 120 101 99 117 116 105 111 110 79 69 50 128 8 10 189 4 8 240 46 16 0 24 0 48 0 56 0 64 0 72 2 80 2 88 2 96 0 104 216 29 112 0 120 174 11 128 1 2 136 1 136 165 215 226 231 38 144 1 223 3 152 1 1 160 1 246 181 215 226 231 38 168 1 223 3 176 1 0 194 1 7 70 73 68 69 83 83 65 200 1 1 210 1 37 79 69 45 50 48 49 50 48 52 48 52 45 48 48 48 48 52 54 55 55 52 48 50 84 82 83 70 49 46 49 46 49 45 48 48 50 49 218 1 78 83 85 70 73 32 83 83 32 49 57 48 48 32 83 84 68 32 64 32 55 46 50 55 32 85 83 68 32 65 67 67 79 85 78 84 32 67 83 87 69 45 73 78 86 45 78 77 77 32 67 79 78 84 82 65 32 65 82 67 65 32 83 70 71 45 67 79 82 82 69 83 80 79 78 68 69 78 84 224 1 203 85 242 1 22 67 65 82 77 69 76 79 46 82 85 66 65 78 79 64 83 85 70 73 46 85 83 248 1 30 128 2 213 11 146 2 4 83 85 70 73 152 2 5 168 2 5 176 2 1 186 2 7 16 11 26 3 85 83 68 192 2 142 34 202 2 7 16 3 26 3 83 84 68 146 3 7 70 73 68 69 83 83 65 162 3 46 79 114 100 101 114 73 110 115 116 114 117 99 116 105 111 110 45 50 48 49 50 48 52 48 52 45 48 48 48 48 48 48 48 48 48 50 49 78 79 83 70 49 45 49 45 49 170 3 7 70 73 68 69 83 83 65 186 3 24 79 114 100 101 114 45 50 48 49 50 48 52 48 52 45 50 49 78 79 83 70 49 45 49 192 3 14 202 3 15 65 114 99 97 69 120 69 120 101 99 86 101 110 117 101 208 3 8 218 3 8 78 89 83 69 65 114 99 97 232 3 213 11 250 3 4 83 85 70 73 128 4 5 136 4 203 85 154 4 22 67 65 82 77 69 76 79 46 82 85 66 65 78 79 64 83 85 70 73 46 85 83 160 4 30 168 4 213 11 186 4 4 83 85 70 73 192 4 5 208 4 210 13 226 4 7 85 78 75 78 79 87 78 240 4 85 130 5 4 65 82 67 65 136 5 5 144 5 85 162 5 4 65 82 67 65 168 5 5 184 5 137 244 17 194 5 12 67 83 87 69 45 73 78 86 45 78 77 77 202 5 4 73 66 82 75 208 5 214 188 12 218 5 17 83 70 71 45 67 79 82 82 69 83 80 79 78 68 69 78 84 226 5 4 73 66 82 75 216 6 0 226 6 2 16 0 128 7 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 58 11 73 66 65 80 80 66 65 76 53 48 52 64 207 247 148 134 237 137 184 231 8] ET[1]=2012-04-04 11:51:01Z}
but im not sure how to use awk or cut to do this, no matter what I do I cant get it right.
I know you have to use $i in awk, but I cant get the split right to get what I want.
any help would be appreciated.
ok, here is how I tried using cut:
cut -d "." -f3- data.log > dataCut.log
This here worked for most of the file, but at some point it cut off the sdmp., which is something I need.
If you have GNU grep then simply:
grep -Po 'PROD[.]\K.*' file
howabout a simple cut:
cut -c68- file
outputs:
sdmp.o.t.0.0.0.0.NewOrderExecutionOE.?.[cut for brevity]
same approach using sed
sed 's/^.\{67\}//' file
using colrm
$ colrm 1 67 < file
perl:
perl -pe 's/^.{67}//' file
Finally awk (can't beat #kent for brevity here)
awk 'BEGIN{FIELDWIDTHS="67 9999"}{print$2}' file
if there is only one PROD., you don't have to split with period ".", you could:
awk -F'PROD.' '$0=$2' input
or
awk -F'PROD\\.' '$0=$2' input
however I guess your PROD.foo.bar could be dynamic, e.g. TEST.foo.bar or DEV.foo.bar..., in this case, you could take the subject=
awk -F'subject=[A-Z]+\\.' '$0=$2' input
you coud adjust [A-Z] if there could be other possibilities. grep with PCRE supported (e.g. gnu grep) could work too.
One way would be to use sub.
awk '{sub(/^[0-9][-0-9:. :)(Z]* subject=PROD./, ""); print;}'
This basically matches everything from "start of line" up to "subject=PROD." and replaces it with an empty string.
While you asked for awk sed may well be THE tool for the job:
sed -r 's/^.+ subject=PROD\.(.*)/\1/' file
Related
I have list of integers, from which I would first like to get unique numbers, first ordered by their occurrences and then the numbers with equal counts should be ordered in descending order.
example 1:
input1 = [1,2,2,1,6,2,1,7]
expected output = [2,1,7,6]
explanation: both 2 and 1 appear thrice while 6 and 7 appear once. so, the numbers occurring thrice will be placed first and in descending order; and same for the set that appears once.
another example case:
input_2 = list(map(int, '40 29 2 44 30 79 46 85 118 66 113 52 55 63 48 99 123 51 110 66 40 115 107 46 6 114 36 99 13 108 85 39 14 121 42 37 56 11 104 28 24 123 63 51 118 52 120 28 64 43 44 86 42 71 101 78 93 1 6 14 42 33 88 107 35 70 74 30 54 76 27 91 115 71 63 103 94 109 39 4 16 108 97 83 29 57 86 121 53 94 28 7 5 31 123 21 2 17 112 104 75 124 88 30 108 14 65 118 28 81 80 14 14 107 21 60 47 97 50 53 19 112 43 46'.split()))
output_2 = list(map(int, '14 28 123 118 108 107 63 46 42 30 121 115 112 104 99 97 94 88 86 85 71 66 53 52 51 44 43 40 39 29 21 6 2 124 120 114 113 110 109 103 101 93 91 83 81 80 79 78 76 75 74 70 65 64 60 57 56 55 54 50 48 47 37 36 35 33 31 27 24 19 17 16 13 11 7 5 4 1'.split()))
This was from a coding test I took. This must be solved without using functions from imports like collections, itertools etc,. and using functions already available in python's namespace like dict, sorted is allowed. How do I do this as efficiently as possible?
def sort_sort(input1):
a = {i:input1.count(i) for i in set(input1)}
b ={i:[] for i in set(a.values())}
for k,v in a.items():
b[v].append(k)
for v in b.values():
v.sort(reverse=True)
output=[]
quays =list(b.keys())
quays.sort(reverse=True)
for q in quays:
output +=b[q]
print(output)
I have a dataset similar to below:
37 151 36 34 40 56 59 42 28 38 60
1 11 0 0 2 2 3 4 0 0 4
35 158 35 37 40 56 58 48 31 40 72
1 2 1 1 0 0 0 0 1 0 0
32 132 32 30 36 57 53 35 25 34 54
8 36 4 8 8 7 13 13 3 6 14
40 162 36 38 41 66 64 46 27 35 60
0 2 0 0 1 0 0 0 1 1 2
32 151 31 34 41 58 66 45 33 40 66
0 5 3 2 1 2 0 1 1 4 6
I want to transform the even rows to even columns like this:
37 1 151 11 36 0 34 0 40 2 56 2 59 3 42 4 28 0 38 0 60 4
35 1 158 2 35 1 37 1 40 0 56 0 58 0 48 0 31 1 40 0 72 0
32 8 132 36 32 4 30 8 36 8 57 7 53 13 35 13 25 3 34 6 54 14
40 0 162 2 36 0 38 0 41 1 66 0 64 0 46 0 27 1 35 1 60 2
32 0 151 5 31 3 34 2 41 1 58 2 66 0 45 1 33 1 40 4 66 6
Basically, I would like to take the even rows and transform them as even columns while retaining the odd rows and odd columns the way they are.
You can do it in a straight-forward manner with awk by saving each field of the the odd number rows in an array and then printing each array element in between the elements of each even number rows, e.g.
awk '
FNR%2{for(i=1;i<=NF;i++)a[i]=$i; next}
{for(i=1;i<=NF;i++) printf " %3d %3d", a[i],$i; print ""}
' file
Where the modulo of the record number (line) FNR is taken to determine odd/even and where odd, the fields are stored in the a[] array and then the next line (even) is printed where each field is printed after the corresponding field in a[].
Example Use/Output
You can adjust the output spacing as wanted. With your data in file you would get:
$ awk '
> FNR%2{for(i=1;i<=NF;i++)a[i]=$i; next}
> {for(i=1;i<=NF;i++) printf " %3d %3d", a[i],$i; print ""}
> ' file
37 1 151 11 36 0 34 0 40 2 56 2 59 3 42 4 28 0 38 0 60 4
35 1 158 2 35 1 37 1 40 0 56 0 58 0 48 0 31 1 40 0 72 0
32 8 132 36 32 4 30 8 36 8 57 7 53 13 35 13 25 3 34 6 54 14
40 0 162 2 36 0 38 0 41 1 66 0 64 0 46 0 27 1 35 1 60 2
32 0 151 5 31 3 34 2 41 1 58 2 66 0 45 1 33 1 40 4 66 6
Without Even Output Spacing:
$ awk '
FNR%2{for(i=1;i<=NF;i++)a[i]=$i; next}
{for(i=1;i<=NF;i++) printf " %d %d", a[i],$i; print ""}
' file
37 1 151 11 36 0 34 0 40 2 56 2 59 3 42 4 28 0 38 0 60 4
35 1 158 2 35 1 37 1 40 0 56 0 58 0 48 0 31 1 40 0 72 0
32 8 132 36 32 4 30 8 36 8 57 7 53 13 35 13 25 3 34 6 54 14
40 0 162 2 36 0 38 0 41 1 66 0 64 0 46 0 27 1 35 1 60 2
32 0 151 5 31 3 34 2 41 1 58 2 66 0 45 1 33 1 40 4 66 6
I have a huge dataset with ID, MEAN, and DATE (in day of the year). I'm sub-setting it below just for example:
OBJECTID MEAN DATE
1 0.960337524 27
2 1.024530873 27
3 1.07565201 27
4 1.32608937 27
5 1.115863256 27
6 0.738648832 27
7 1.209547088 27
8 1.190287749 27
1 1.311272704 43
2 1.421150386 43
3 1.341622942 43
4 1.343600738 43
5 1.322288454 43
6 1.057037145 43
7 1.262514248 43
8 1.148541133 43
1 1.141311572 75
2 1.12654984 75
3 1.125632558 75
4 1.128487158 75
5 1.181200445 75
6 0.820567181 75
7 0.973662794 75
8 0.903646102 75
In this example, the first date is DAY 27 (Jan 27th). I want to reformat this in Excel so DATE is the horizontal header and ID is the first vertical column like this:
OBJECTID 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
1
2
3
4
5
6
7
8
How do I use INDEX and MATCH to populate the cells in the blank table above with the values in the dataset? Not all dates in the table will have a value so I need it to populate it with zero like this:
OBJECTID 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.960337524 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.311272704 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.141311572 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2
3
4
5
6
7
8
This is what I came up with so far:
=IFERROR(INDEX($B$2:$B$2617, MATCH(0, COUNTIF($E2:E2,$B$2:$B$2617)+IF($A$2:$A$2617<>$E2, 1, 0), 0)), 0)
But it doesn't account for the dates with no values. It put the MEAN value for Day 27 into the cell for Day 1.
OBJECTID MEAN DATE OBJECTID 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
1 0.960337524 27 1 0.960337524
2 1.024530873 27 2
3 1.07565201 27 3
4 1.32608937 27 4
5 1.115863256 27 5
6 0.738648832 27 6
7 1.209547088 27 7
8 1.190287749 27 8
1 1.311272704 43
2 1.421150386 43
3 1.341622942 43
4 1.343600738 43
5 1.322288454 43
6 1.057037145 43
7 1.262514248 43
8 1.148541133 43
1 1.141311572 75
2 1.12654984 75
3 1.125632558 75
4 1.128487158 75
5 1.181200445 75
6 0.820567181 75
7 0.973662794 75
8 0.903646102 75
Any advice or push in the right direction would be appreciated!
On condition that there is only one Mean in your data for each combination of ID and Date the formula below will do the job. (Input is the sheet with your data in it.)
=SUMIFS(Input!$B$2:$B$2617,Input!$A$2:$A$2617,$A2,Input!$C$2:$C$2617,B$1)
However, this formula makes the range management too error prone. Luckily most errors in the range setting will result in a formula error but the process can be much simplified by separating range management from data extraction.
I assigned the name Data to the range Input!$A$2:$C$2617. In fact, you would probably construct this range to be dynamic so that it adjusts to the number of data rows you have automatically. But that is an extra benefit of properly managing ranges which is outside the scope of your present question.
Use the range Data in the above formula you arrive at this:-
=SUMIFS(INDEX(Data,,2),INDEX(Data,,1),$A2,INDEX(Data,,3),B$1)
Either this formula or the one first above introduced can be copied to the right and down to cover your entire output table. If they bother you (as they did me) you can suppress the display of zeros in the sheet or in each cell, using the sheet settings or the cell format to do so.
What you can do is create another unique ID using simple "&" (concat) function. Basically add a 4th column which has the formula
=A2&"_"&C2
The above takes the assumption that your first entry is in 2nd row and this formula is for 2nd row as well which you can drag. Once done then you can apply index match on this new ID.
Hope it helps in clearing your query.
I have created a quick .svg of the StackOverflow logo, which looks like this:
With the following data in the .svg file itself:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="256.000000pt" height="256.000000pt" viewBox="0 0 256.000000 256.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,256.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M1095 2549 c-464 -62 -875 -402 -1029 -850 -57 -168 -78 -379 -58
-579 44 -421 317 -806 706 -995 187 -91 340 -125 566 -125 222 0 378 34 558
120 142 68 239 138 352 250 113 113 184 213 250 353 95 199 127 366 117 622
-8 221 -61 406 -167 584 -70 118 -118 177 -225 279 -178 170 -382 278 -618
326 -95 20 -356 28 -452 15z m695 -466 c0 -5 22 -135 49 -291 27 -155 46 -284
42 -286 -3 -2 -27 -7 -53 -11 -44 -7 -47 -6 -53 16 -17 74 -95 552 -91 557 5
5 65 18 94 21 6 0 12 -2 12 -6z m-240 -344 c80 -117 153 -224 163 -240 l18
-28 -42 -31 -43 -31 -18 23 c-10 13 -84 121 -165 241 l-148 219 35 29 c19 16
39 29 45 29 5 0 75 -95 155 -211z m-195 -219 c132 -78 242 -143 244 -145 2 -2
-9 -25 -23 -50 -25 -41 -29 -44 -49 -34 -51 26 -467 281 -472 289 -7 11 43 92
53 87 4 -3 115 -69 247 -147z m-107 -221 c152 -40 279 -73 281 -75 5 -5 -30
-104 -37 -104 -12 0 -526 140 -543 148 -15 6 -15 12 -3 55 8 26 17 47 20 47 3
0 130 -32 282 -71z m-458 -384 l0 -265 405 0 405 0 0 265 0 265 40 0 40 0 0
-310 0 -310 -495 0 -495 0 0 310 0 310 50 0 50 0 0 -265z m390 165 c124 -11
245 -23 269 -27 l43 -6 -5 -50 c-4 -27 -8 -51 -9 -53 -2 -1 -134 9 -294 23
l-291 26 4 46 c7 66 10 72 35 66 13 -2 124 -14 248 -25z m300 -255 l0 -55
-295 0 -295 0 0 55 0 55 295 0 295 0 0 -55z"/>
</g>
</svg>
And I'm attempting to resize it to 30x30 like so:
convert stackoverflow-4-xxl.svg -resize 30x30 stackoverflow-4-xxl_s.svg
But this produces an empty image (even though data is still present, as seen in the .svg file itself, below)
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="30" height="30">
<g style="" transform="scale(1.25,1.25)">
<g style="fill:#000000;stroke:none;" transform="matrix(0.1 0 0 -0.1 0 256)">
<g style="" transform="matrix(0.1 0 0 -0.1 0 256)">
<path d="M1095 2549 c-464 -62 -875 -402 -1029 -850 -57 -168 -78 -379 -58 -579 44 -421 317 -806 706 -995 187 -91 340 -125 566 -125 222 0 378 34 558 120 142 68 239 138 352 250 113 113 184 213 250 353 95 199 127 366 117 622 -8 221 -61 406 -167 584 -70 118 -118 177 -225 279 -178 170 -382 278 -618 326 -95 20 -356 28 -452 15z m695 -466 c0 -5 22 -135 49 -291 27 -155 46 -284 42 -286 -3 -2 -27 -7 -53 -11 -44 -7 -47 -6 -53 16 -17 74 -95 552 -91 557 5 5 65 18 94 21 6 0 12 -2 12 -6z m-240 -344 c80 -117 153 -224 163 -240 l18 -28 -42 -31 -43 -31 -18 23 c-10 13 -84 121 -165 241 l-148 219 35 29 c19 16 39 29 45 29 5 0 75 -95 155 -211z m-195 -219 c132 -78 242 -143 244 -145 2 -2 -9 -25 -23 -50 -25 -41 -29 -44 -49 -34 -51 26 -467 281 -472 289 -7 11 43 92 53 87 4 -3 115 -69 247 -147z m-107 -221 c152 -40 279 -73 281 -75 5 -5 -30 -104 -37 -104 -12 0 -526 140 -543 148 -15 6 -15 12 -3 55 8 26 17 47 20 47 3 0 130 -32 282 -71z m-458 -384 l0 -265 405 0 405 0 0 265 0 265 40 0 40 0 0 -310 0 -310 -495 0 -495 0 0 310 0 310 50 0 50 0 0 -265z m390 165 c124 -11 245 -23 269 -27 l43 -6 -5 -50 c-4 -27 -8 -51 -9 -53 -2 -1 -134 9 -294 23 l-291 26 4 46 c7 66 10 72 35 66 13 -2 124 -14 248 -25z m300 -255 l0 -55 -295 0 -295 0 0 55 0 55 295 0 295 0 0 -55z"/>
</g>
</g>
</g>
</svg>
So, just to see if resizing to the same size produces the original image (or therabouts), I did:
convert stackoverflow-4-xxl.svg -resize 256x256 stackoverflow-4-xxl_m.svg
And this still produced an empty image, with the .svg data identical except for:
<svg width="256" height="256">
Any idea where I'm going wrong?
You don't need to use a program.
Either:
hand edit the SVG. Change the width and height to 30px.
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="30px" height="30px" viewBox="0 0 256.000000 256.000000"
preserveAspectRatio="xMidYMid meet">...
Or if you want to style its size with CSS, just remove the width and height.
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 256.000000 256.000000"
preserveAspectRatio="xMidYMid meet">...
I'm actually trying to make a density map but the key word seems to be heat map. Here is my issue. I have a data file which looks like this: (the formatting is weird but it's a 12x12 square matrix with each column separated by space)
#orbital 1
#upspin density
50 49 51 48 54 50 49 46 51 52 49 49
49 52 55 52 53 52 48 51 53 49 50 54
46 54 53 53 52 48 51 53 50 47 49 50
50 51 50 51 47 49 51 55 48 49 48 50
51 53 49 49 49 54 49 49 53 52 51 50
49 51 51 49 55 54 49 51 49 52 50 51
49 46 51 52 49 49 50 49 51 48 54 50
48 51 53 49 50 54 49 52 55 52 53 52
51 53 50 47 49 50 46 54 53 53 52 48
51 55 48 49 48 50 50 51 50 51 47 49
49 49 53 52 51 50 51 53 49 49 49 54
49 51 49 52 50 51 49 51 51 49 55 54
#downspin density
50 49 51 48 54 50 49 46 51 52 49 49
49 52 55 52 53 52 48 51 53 49 50 54
46 54 53 53 52 48 51 53 50 47 49 50
50 51 50 51 47 49 51 55 48 49 48 50
51 53 49 49 49 54 49 49 53 52 51 50
49 51 51 49 55 54 49 51 49 52 50 51
49 46 51 52 49 49 50 49 51 48 54 50
48 51 53 49 50 54 49 52 55 52 53 52
51 53 50 47 49 50 46 54 53 53 52 48
51 55 48 49 48 50 50 51 50 51 47 49
49 49 53 52 51 50 51 53 49 49 49 54
49 51 49 52 50 51 49 51 51 49 55 54
#upspin + downspin
100 98 102 96 107 99 97 91 102 103 97 97
98 103 110 103 105 104 96 101 106 97 99 107
91 108 106 106 103 95 101 105 100 93 97 100
100 101 99 101 93 98 102 109 96 98 95 99
101 105 97 97 98 108 98 98 106 103 102 99
97 102 101 98 109 108 97 102 97 103 100 101
97 91 102 103 97 97 100 98 102 96 107 99
96 101 106 97 99 107 98 103 110 103 105 104
101 105 100 93 97 100 91 108 106 106 103 95
102 109 96 98 95 99 100 101 99 101 93 98
98 98 106 103 102 99 101 105 97 97 98 108
97 102 97 103 100 101 97 102 101 98 109 108
#upspin - downspin
0 0 1 1 0 0 0 0 0 1 1 0
0 0 1 1 0 1 1 0 0 1 0 0
1 1 1 0 1 0 1 1 0 0 0 0
0 0 1 1 1 1 1 1 0 1 0 0
1 1 0 1 0 1 1 1 1 0 1 1
1 0 1 1 1 0 1 0 1 0 1 0
0 1 1 0 1 0 0 1 0 1 0 0
1 1 0 1 1 1 1 0 1 1 1 1
0 1 1 1 1 0 0 0 0 0 0 0
1 1 0 1 1 1 0 1 0 1 1 0
1 0 0 1 1 0 0 0 1 1 1 1
1 0 0 0 1 0 1 0 0 0 0 1
#atom 1
#total upspin density downspin density
50 49 51 48 54 50 49 46 51 52 49 49
49 52 55 52 53 52 48 51 53 49 50 54
46 54 53 53 52 48 51 53 50 47 49 50
50 51 50 51 47 49 51 55 48 49 48 50
51 53 49 49 49 54 49 49 53 52 51 50
49 51 51 49 55 54 49 51 49 52 50 51
49 46 51 52 49 49 50 49 51 48 54 50
48 51 53 49 50 54 49 52 55 52 53 52
51 53 50 47 49 50 46 54 53 53 52 48
51 55 48 49 48 50 50 51 50 51 47 49
49 49 53 52 51 50 51 53 49 49 49 54
49 51 49 52 50 51 49 51 51 49 55 54
#total downspin density
50 49 51 48 54 50 49 46 51 52 49 49
49 52 55 52 53 52 48 51 53 49 50 54
46 54 53 53 52 48 51 53 50 47 49 50
50 51 50 51 47 49 51 55 48 49 48 50
51 53 49 49 49 54 49 49 53 52 51 50
49 51 51 49 55 54 49 51 49 52 50 51
49 46 51 52 49 49 50 49 51 48 54 50
48 51 53 49 50 54 49 52 55 52 53 52
51 53 50 47 49 50 46 54 53 53 52 48
51 55 48 49 48 50 50 51 50 51 47 49
49 49 53 52 51 50 51 53 49 49 49 54
49 51 49 52 50 51 49 51 51 49 55 54
I am trying to write a script that takes these matrices and make an individual "heat map" for each. My issue is that when I run the script I'm getting an error that says the data doesn't represent a grid.My script is below. An additional question is what are the acceptable formats for gnuplot to read a matrix?
set size ratio 1
set cbrange [0:0.5]
set palette defined (0 "red", 1 "blue")
set autoscale xfix
set autoscale yfix
set xtics 1
set ytics 1
set title "8x8 spin"
set tics scale 0,0.001
set mxtics 2
set mytics 2
set grid front mxtics mytics lw 1.5 lt -1 lc rgb 'white'
plot "densityarrays.d" matrix w image notitle
set term png enhanced
set output "/home/thecollective/Desktop/plots/plot1.png"
replot