Transposition Cipher: How to solve - encryption

I have a ciphertext as follows, of which I do not know the keylength:
wlna evesy ehudre thnma upbum w onaw-dino olsile tf hndcseoorl foouA. bnsst uho,et r,vweeirh teorf efer tsw lae tsutas sfeccsan,ul eytd hduu sbhe edtmel faut s,b bo nte oefrroeth ad ofhlea fl, in nthdan olwe hacpe lenbe euce rdo edt acsuhutobslinre ut,h tae a sv tmsoeedswitiny cl ardesro ndipipn ino,ng trat reeac edimanthf o chme ay einrh iwhccodha ur stoorn uftentuauac aqnctina dse oy.realgea Lrsea ms nos fl kiceofdan wi tndieer eroscvto edsindre oun a usht-out e,bcoo n wesin o retou befwh,nd mahic vehy alax ep teindre hepe nsecho oftul sebox kybhi eswav chhenbe eeal aref dyrd rereHo.to r ow uaudhyrencli erngie ba hdconee edenvym r fogaeth terdne to h wospt hrheecore ed rveeseshi menss hhigtreeav edimanevo fr m erarytysee e wrot itn to frof hesulmt ohi d,wol cht aud sy e vrn apli. ltaead Hehdev ei blntycanee d irre bwdono ty wonrpesne s,owhf o ad omhare rmy bkall asml aefethe ndtert ohsun uu llaly ogare Osne.e tn he,owhlwat i stms obar pothebl he atteni slglEt nanhisminb, eg le
How would I be able to decipher this transposed ciphertext in a non-manual way like on https://tholman.com/other/transposition/ ?
I believe that the punctuation and spaces matter as well in this ciphertext.

Related

11 g client SQL*loader: insert datetime is not working

I have the following data
85566186;DATACONTRACT;1;0;-0.0235;0.6361;0.4448;59;None;N;dnn_auc_0.650_acc_0.670_sensitivity_0.670_specificity_0.640.h5;0.1;;2020-01-26 00:00:00;2020-01-27 19:26:54;18
I need to uploda that into the following oracle table:
CREATE TABLE DATAFOUNDATION.SHAPELY_SCORES_2
(
A INTEGER
, B VARCHAR2(1000)
, C NUMBER
, D VARCHAR2(1000)
, E NUMBER
, F NUMBER
, G NUMBER
, H INTEGER
, I VARCHAR2(4000)
, J VARCHAR2(16)
, K VARCHAR2(1000)
, L NUMBER
, M VARCHAR2(64)
, N DATE
, O DATE
, P INTEGER
)
;
I using the follwing control file:
load data
INFILE 'shaply_test.txt'
INTO TABLE DATAFOUNDATION.SHAPELY_SCORES_2
INSERT
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
(
A INTEGER(8) nullif A= BLANKS,
B nullif B = BLANKS,
C DOUBLE nullif C= BLANKS,
D nullif D = BLANKS,
E INTEGER nullif E= BLANKS,
F FLOAT nullif F= BLANKS,
G FLOAT nullif G = BLANKS,
H FLOAT nullif H= BLANKS,
I nullif I= BLANKS,
J nullif J= BLANKS,
K nullif K = BLANKS,
L FLOAT nullif L= BLANKS,
M nullif M= BLANKS,
N TIMESTAMP 'YYYY-MM-DD hh24:mi:ss' nullif N = BLANKS,
O TIMESTAMP 'YYYY-MM-DD hh24:mi:ss' nullif O = BLANKS,
P INTEGER(8) nullif P = BLANKS)
But I am getting the following error (sorry its in German but the message is simple to translate)
SQL*Loader: Release 11.2.0.1.0 - Production on Fr Feb 7 19:14:54 2020
Spaltenname Position Läng Term Eing Datentyp
------------------------------ ---------- ----- ---- ---- --------------------- A FIRST 8 INTEGER
NULL wenn A = BLANKS B NEXT * ; CHARACTER
NULL wenn B = BLANKS C NEXT 8 DOUBLE
NULL wenn C = BLANKS D NEXT * ; CHARACTER
NULL wenn D = BLANKS E NEXT 4 INTEGER
NULL wenn E = BLANKS F NEXT 4 FLOAT
NULL wenn F = BLANKS G NEXT 4 FLOAT
NULL wenn G = BLANKS H NEXT 4 FLOAT
NULL wenn H = BLANKS I NEXT * ; CHARACTER
NULL wenn I = BLANKS J NEXT * ; CHARACTER
NULL wenn J = BLANKS K NEXT * ; CHARACTER
NULL wenn K = BLANKS L NEXT 4 FLOAT
NULL wenn L = BLANKS M NEXT * ; CHARACTER
NULL wenn M = BLANKS N NEXT * ; DATETIME YYYY-MM-DD hh24:mi:ss
NULL wenn N = BLANKS O NEXT * ; DATETIME YYYY-MM-DD hh24:mi:ss
NULL wenn O = BLANKS P NEXT 8 INTEGER
NULL wenn P = BLANKS
Satz 1: Abgelehnt - Fehler in Tabelle DATAFOUNDATION.SHAPELY_SCORES_2,
Spalte N. ORA-01841: (Volles) Jahr muss zwischen -4713
und +9999 liegen und darf nicht 0 sein
Tabelle DATAFOUNDATION.SHAPELY_SCORES_2: 0 Zeilen erfolgreich
geladen. 1 Zeile aufgrund von Datenfehlern nicht geladen. 0 Zeilen
nicht geladen, da alle WHEN-Klauseln fehlerhaft waren. 0 Zeilen
nicht geladen, da alle Felder NULL waren.
Zugewiesener Bereich für Bind-Array: 134912 Bytes (64
Zeilen) Byte in Lese-Puffer: 1048576
Gesamtzahl der übersprungenen logischen Datensätze: 0
Gesamtzahl der gelesenen logischen Datensätze: 1
Gesamtzahl der abgelehnten logischen Datensätze: 1
Gesamtzahl der zurückgewiesenen logischen Datensätze: 0
Lauf begonnen am Fr Feb 07 19:14:54 2020 Lauf beendet am Fr Feb 07
19:14:54 2020
Abgelaufene Zeit: 00:00:00.16 CPU-Zeit: 00:00:00.04
Can anyone please tell me what I am doing wrong here?
I found the solution. There were two problems in my code. 1st is I was using FLOAT/DOUBLE but DECIMAL EXTERNAL was required (link)
2nd problem was with the format of decimal (always a catch with regional settings). I used the following line added for each decimal value column:
"REPLACE(:column_name, '.', ',')"
e.g.,
C DECIMAL EXTERNAL nullif C = BLANKS "REPLACE(:C, '.', ',')",
:).

Extract date from a text document in R

I am again here with an interesting problem.
I have a document like shown below:
"""UDAYA FILLING STATION ps\na MATTUPATTY ROAD oe\noe 4 MUNNAR Be:\nSeat 4 04865230318 Rat\nBree 4 ORIGINAL bepas e\n\noe: Han Die MC DE ER DC I se ek OO UO a Be ten\" % aot\n: ag 29-MAY-2019 14:02:23 [i\n— INVOICE NO: 292 hee fos\nae VEHICLE NO: NOT ENTERED Bea\nss NOZZLE NO : 1 ome\n- PRODUCT: PETROL ae\ne RATE : 75.01 INR/Ltr yee\n“| VOLUME: 1.33 Ltr ae\n~ 9 =6AMOUNT: 100.00 INR mae wae\nage, Ee pel Di EE I EE oe NE BE DO DC DE a De ee De ae Cate\notome S.1T. No : 27430268741C =. ver\nnes M.S.T. No: 27430268741V ae\n\nThank You! Visit Again\n""""
From the above document, I need to extract date highlighted in bold and Italics.
I tried with strpdate function but did not get the desired results.
Any help will be greatly appreciated.
Thanks in advance.
Assuming you only want to capture a single date, you may use sub here:
text <- "UDAYA FILLING STATION ps\na MATTUPATTY ROAD oe\noe 4 MUNNAR Be:\nSeat 4 04865230318 Rat\nBree 4 ORIGINAL bepas e\n\noe: Han Die MC DE ER DC I se ek OO UO a Be ten\" % aot\n: ag 29-MAY-2019 14:02:23 [i\n— INVOICE NO: 292 hee fos\nae VEHICLE NO: NOT ENTERED Bea\nss NOZZLE NO : 1 ome\n- PRODUCT: PETROL ae\ne RATE : 75.01 INR/Ltr yee\n“| VOLUME: 1.33 Ltr ae\n~ 9 =6AMOUNT: 100.00 INR mae wae\nage, Ee pel Di EE I EE oe NE BE DO DC DE a De ee De ae Cate\notome S.1T. No : 27430268741C =. ver\nnes M.S.T. No: 27430268741V ae\n\nThank You! Visit Again\n"
date <- sub("^.*\\b(\\d{2}-[A-Z]+-\\d{4})\\b.*", "\\1", text)
date
[1] "29-MAY-2019"
If you had the need to match multiple such dates in your text, then you may use regmatches along with regexec:
text <- "Hello World 29-MAY-2019 Goodbye World 01-JAN-2018"
regmatches(text,regexec("\\b(\\d{2}-[A-Z]+-\\d{4})\\b", text))[[1]]
[1] "29-MAY-2019" "29-MAY-2019"

Split a String in R, using specifc criteria [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have this vector of characters and I need to split the elements in every row.
Here's the image and the code of the dataset:
Y = c("Voci dell’attivo 31-dic-2018 31-dic-2017", "10. Cassa e disponibilità liquide 113.154.047 105.800.459",
"20. Attività finanziarie valutate al fair value con impatto a conto economico 18.400.808 16.926.126",
"a) attività finanziarie detenute per la negoziazione 4.343.408 4.356.151",
"c) altre attività finanziarie obbligatoriamente valutate al fair value 14.057.400 12.569.975",
"30. Attività finanziarie valutate al fair value con impatto sulla redditività complessiva 636.155.429 738.384.151",
"40. Attività finanziarie valutate al costo ammortizzato 11.203.834.137 11.113.118.111",
"a) crediti verso banche 3.198.599.841 3.375.218.889", "b) crediti verso clientela 8.005.234.296 7.737.899.222",
"50. Derivati di copertura 516.238 696.134", "70. Partecipazioni 183.546.796 156.038.259",
"80. Attività materiali 224.588.110 237.315.814", "90. Attività immateriali 1.917.192 2.041.953",
"di cui:", "- avviamento 1.650.000 1.650.000", "100. Attività fiscali 222.227.750 175.106.461",
"a) correnti 4.897.477 10.066.708", "b) anticipate 217.330.273 165.039.753",
"120. Altre attività 82.551.535 110.120.187", "Totale dell'attivo 12.686.892.042 12.655.547.655",
"(unità di euro)", "Voci del passivo e del patrimonio netto",
"31-dic-2018 31-dic-2017", "10. Passività finanziarie valutate al costo ammortizzato 11.375.985.022 11.176.338.096",
"a) debiti verso banche 146.551.210 144.854.107", "b) debiti verso clientela 10.861.850.231 10.251.703.644",
"c) titoli in circolazione 367.583.581 779.780.345", "20. Passività finanziarie di negoziazione 2.392.620 2.370.319",
"40. Derivati di copertura 6.189.059 2.971.997", "60. Passività fiscali 4.091.701 3.909.554",
"a) correnti 752.147 -", "b) differite 3.339.554 3.909.554",
"80. Altre passività 239.940.794 152.157.192", "90. Trattamento di fine rapporto del personale 54.720.108 56.331.622",
"100. Fondi per rischi e oneri: 66.580.390 69.699.078", "a) impegni e garanzie rilasciate 12.705.663 9.475.181",
"c) altri fondi per rischi e oneri 53.874.727 60.223.897", "110. Riserve da valutazione 119.988.702 139.381.644",
"140. Riserve 460.527.397 761.938.256", "150. Sovrapprezzi di emissione 126.318.353 126.318.353",
"160. Capitale 155.247.762 155.247.762", "180. Utile (perdita) d’esercizio (+/-) 74.910.134 8.883.782",
"Totale del passivo e del patrimonio netto 12.686.892.042 12.655.547.655")
Basically what should I do is:
Put the first numbers/parenthsesis and ALL the following words into a column
Put the first number in a second column
Delete the last number
I don't know how to make R recognize different type of element inside the same string. How can I do this?
Given your Y, this should achieve what you want, or get very close to that:
library(tidyverse)
tibble(orig = str_remove(string = Y, pattern = " [[:digit:][:punct:]]+$")) %>%
transmute(col1 = str_remove(string = orig, pattern = " [[:digit:][:punct:]]+$"),
col2 = str_extract(string = orig, pattern = "[[:digit:][:punct:]]+$"))
#> # A tibble: 43 x 2
#> col1 col2
#> <chr> <chr>
#> 1 Voci dell’attivo 31-dic-2018 31-dic-2017 -2017
#> 2 10. Cassa e disponibilità liquide 113.154.047
#> 3 20. Attività finanziarie valutate al fair value con impatt… 18.400.808
#> 4 a) attività finanziarie detenute per la negoziazione 4.343.408
#> 5 c) altre attività finanziarie obbligatoriamente valutate a… 14.057.400
#> 6 30. Attività finanziarie valutate al fair value con impatt… 636.155.429
#> 7 40. Attività finanziarie valutate al costo ammortizzato 11.203.834.…
#> 8 a) crediti verso banche 3.198.599.8…
#> 9 b) crediti verso clientela 8.005.234.2…
#> 10 50. Derivati di copertura 516.238
#> # … with 33 more rows
Created on 2019-10-09 by the reprex package (v0.3.0)
To clarify: using the dollar sign it tells regex to start looking from matches from the end of the string, so what happens with that code is that first it removes the last combination of digits and points, then, from the remaining strings, it either keeps or remove digits and points to create the two columns.

GLPK: access to data array with variable length

set ORIG;
set DEST;
set LINKS within {ORIG,DEST};
printf {i in ORIG, j in DEST} "LINKS[%s,%s] = %g \n",i,j,LINKS[i][j];
data;
set ORIG := GARY CLEV PITT;
set DEST := FRA DET LAN WIN STL FRE LAF;
set LINKS :=
(GARY,*) DET LAN STL LAF
(CLEV,*) FRA DET LAN WIN STL LAF
(PITT,*) FRA WIN STL FRE;
end;
This stops with this error message:
LINKS cannot be subscripted
How can I define LINKS so that it can be accessed with LINKS[i][j]?
With some advice from gnu-help, this seems to be a better syntax
for this problem:
set ORIG;
set DEST;
param LINKS{ORIG, DEST} default 0;
for {i in ORIG, j in DEST} printf "LINKS[%s,%s] = %g \n",i,j,LINKS[i,j];
data;
set ORIG := GARY CLEV PITT;
set DEST := FRA DET LAN WIN STL FRE LAF;
param LINKS : FRA DET LAN WIN STL FRE LAF :=
GARY 1 2 3 4 5 6 .
CLEV . 2 . 4 . 6 .
PITT 1 2 3 4 5 6 7;
end;

Remove duplicate line based on column for fixed length file

I have a fixed length file having primary key from 1-8. there is no delimiter. I want to eliminate duplicates by eliminating second occurrence. Look for solutions in unix.
File looks like this:
A00991CCAGXCD K 9999PHLX CANADIAN DOLLAR F
G0084W10%AEURN 4612EURONAV NV ANTWERPEN F
D1819089%ADB 6021DEUTSCHE BANK AG F
G0084W10GAADNT 6799ADIENT PLC F
D1F19089NADB 6021DEUTSCHE BANK AG F
Output extected is:
A00991CCAGXCD K 9999PHLX CANADIAN DOLLAR F
G0084W10%AEURN 4612EURONAV NV ANTWERPEN F
D1819089%ADB 6021DEUTSCHE BANK AG F
D1F19089NADB 6021DEUTSCHE BANK AG F
Short awk solution:
awk '!a[substr($1,1,8)]++' file
The output:
A00991CCAGXCD K 9999PHLX CANADIAN DOLLAR F
G0084W10%AEURN 4612EURONAV NV ANTWERPEN F
D1819089%ADB 6021DEUTSCHE BANK AG F
D1F19089NADB 6021DEUTSCHE BANK AG F
substr($1,1,8) - returns 8-character-long substring from the 1st field $1 (starting from the 1st char)
!a[...]++ - considering only the first occurence of unique array index

Resources