-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completely unexpted output of put, then cut, then label #1564
Comments
Hi @ghmon ,
|
Thank you!!! That works! I close the issue. Your usage of "-o Retain fields in the order specified" was also crucial. |
ok @ghmon , if it's ok, please close the issue |
[miller 6.12.0]
After searching an error in my statement for two hours, then even asked chatgpt-4 which came out with exactly the same solution i used before i consider this a bug or a profound misunderstanding of miller.
Task: read csv file, add new column, cut part of columns and rearrange, new label (header).
with awk/sed:
echo latitude,longitude,elevation,name; awk -v FS="," '{ print $5 "," $4 ",0," $1}' "$1" | sed 1d
Input (first two data lines only):
Sendername,Block,Blockmittenfrequenz,Geo Länge WGS84,Geo Breite WGS84,Land geographisch,T-DAB-Modus,ERP-MAX horizontal,ERP-MAX vertikal,Polarisation,Antennencharakteristik D/N,HEFF_MAX,Land administrativ,Datum der Veröffentlichung,Datum der Änderung
Aachen,9A,202.928,6.24417,50.7714,D,null,null,30.0,V,D,358,D,28.04.2024,null
Aachen,9A,202.928,6.24361,50.7836,D,null,null,37.5,V,D,355,D,28.04.2024,null
Command (in a bash script):
mlr --csv --from "$1" \
put '$elevation = "0"' \
then cut -f '{Geo Breite WGS84},{Geo Länge WGS84},elevation,Sendername' \
then label latitude,longitude,elevation,name
Output (first two data lines only):
latitude,longitude
Aachen,0
Aachen,0
Expected output:
latitude,longitude,elevation,name
50.7714,6.24417,0,Aachen
50.7836,6.24361,0,Aachen
The text was updated successfully, but these errors were encountered: