Giter Club home page Giter Club logo

Comments (7)

johnkerl avatar johnkerl commented on June 26, 2024 2

@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.

karudonaldson avatar karudonaldson commented on June 26, 2024 2

Thank you both for your help! I managed to get a preliminary solution tested this morning :)

from miller.

aborruso avatar aborruso commented on June 26, 2024 1

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.

aborruso avatar aborruso commented on June 26, 2024

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.

karudonaldson avatar karudonaldson commented on June 26, 2024

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.

aborruso avatar aborruso commented on June 26, 2024

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.

karudonaldson avatar karudonaldson commented on June 26, 2024

ok so imagine example.csv looks like this
Screenshot 2024-04-10 at 10 34 16 PM

I need to strip column data in column "two" without affecting the header or column order.
The result being:
Screenshot 2024-04-10 at 10 35 49 PM

There is roughly 100+ columns, where around 30 need to be cleared.

Does that make more sense?

from miller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.