Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nicely done using Unix utils. You can have a pure sed solution (save the `ls` invocation) that is much simpler, albeit obscure, that hinges on the fact that every number has a `data.csv` file.

Given a sorted list of these files (through `ls` or otherwise) the following sed code will print out the data files for which A did not succeed on them.

  /data/!N
  /A/d
  P;D

This works on the fact that there exists a data file for all successful and unsuccessful runs on data, so sed simply prints the files for which there does not exist an `A` counterpart.

If you want to only print out the numbers, you can add a substitution or two towards the end.

  /data/!N
  /A/d
  s/^0*\|_.*//g;P;D
Edit: fixed the sed program


Actually the following is even shorter

  /A/{N;d;}
So all together this gives the following

  ls|sed '/A/{N;d;}'




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: