Comments (7)
@karudonaldson more generally perhaps:
$ cat example.csv
one,two,three,four,seven,eight,thirty
pan,pan,1,0.347,0.727,0.252,10
eks,pan,2,0.759,0.522,0.396,20
wye,wye,3,0.205,0.338,0.069,30
eks,wye,4,0.381,0.134,0.051,40
wye,pan,5,0.573,0.864,0.495,50
zee,pan,6,0.527,0.493,0.260,60
eks,zee,7,0.612,0.188,0.115,70
zee,wye,8,0.599,0.976,0.584,80
hat,wye,9,0.031,0.750,0.024,90
pan,wye,10,0.503,0.953,0.479,100
mlr --csv --from example.csv put '
begin {
@names = ["two", "seven", "thirty"]
}
for (name in @names) {
$[name] = ""
}
'
one,two,three,four,seven,eight,thirty
pan,,1,0.347,,0.252,
eks,,2,0.759,,0.396,
wye,,3,0.205,,0.069,
eks,,4,0.381,,0.051,
wye,,5,0.573,,0.495,
zee,,6,0.527,,0.260,
eks,,7,0.612,,0.115,
zee,,8,0.599,,0.584,
hat,,9,0.031,,0.024,
pan,,10,0.503,,0.479,
from miller.
Thank you both for your help! I managed to get a preliminary solution tested this morning :)
from miller.
If you have
a,b,c
1,2,4
3,5,6
7,8,9
you can use put and run mlrgo --csv put '$b=""' input.csv
to get
a,b,c
1,,4
3,,6
7,,9
Have you read the manual? It is very well written.
Have you done any tests?
from miller.
Hi @karudonaldson I'm not sure I understand what your goal is.
Looking for a tool that monitors the creation of new files in a folder, and as soon as there is a new one apply a Miller command?
One tool for monitoring a folder is, for example, inotifywait.
from miller.
Thanks for the response @aborruso.
Ideally looking for functionality to:
- clear predefined column data without removing the column
- above process must retain headers and column order
- require a process to monitor for newly created CSV files in a folder
- if a new file is detected, execute column clearing process
It appears miller can do the column clearing process, but not sure how?
from miller.
Miller is used to process structured text files. You can write a bash script and have it do what you want.
If you have an example of input and the processing you would like to do, I can give you an example.
from miller.
ok so imagine example.csv looks like this
I need to strip column data in column "two" without affecting the header or column order.
The result being:
There is roughly 100+ columns, where around 30 need to be cleared.
Does that make more sense?
from miller.
Related Issues (20)
- `mlr --icsv --ojson cat < mlr.bug.csv` drops some columns HOT 5
- Add description for "put" verb HOT 1
- 'mlr cut' is very slow HOT 8
- `mlr --otsv` does not handle broken quotes correctly compared to `--ocsv` HOT 6
- JSON to CSV Error HOT 8
- Exit code = 1 for `--csv skip-trivial-records` and CSV file's last record is blank HOT 1
- JSON flag documentation question HOT 1
- Equivalent to Excel function "data load from folder" then "combine and load" multiple CSV's finally "apply transformations" HOT 7
- Find and remove "string" retaining all other row data HOT 5
- Find and replace special character & with and using ssub HOT 4
- Add a `stat` DSL function HOT 4
- Notwithstanding `--skip-comments`, double-quoted tokens in comment are mishandled with any `--c2*` option HOT 4
- Completely unexpted output of put, then cut, then label HOT 3
- do we have python binding? HOT 1
- About `--transpose` in the documentation
- Newlines in fields | CSV file: Header/data length mismatch HOT 6
- More than one blank line at the end of CSV file: automate cleanup? HOT 4
- Feature request: NO_COLOR standard implementation HOT 1
- splita/splitax error when field contains a single value HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miller.