News for hackers. Stuff that matters.
Re:Problem solving with Unix commands by inp on Thursday February 14, 2019 @07:23AM (#19161335)
Instead to create a script in Python to convert numbers in integers, you can use awk: "python3 parse.py" becomes "awk '{printf "%d\n", $0}'"
Re:Problem solving with Unix commands by tyingq on Thursday February 14, 2019 @07:32AM (#19161376)
Not sure I understand why it needs to even know there's numbers in the filename.

The problem seems to boil down to:

"Find all files with the pattern '[something]_data.csv' and report if '[something]_A.csv' doesn't exist"

Unless I'm missing something, all the sorting and sequence generation isn't adding anything.

Re:Problem solving with Unix commands by darrenf on Thursday February 14, 2019 @07:25AM (#19161348)
Why even use awk rather than the shell's (well, bash's) builtin printf?

    $ printf '%d\n' "0005"
    5
Re:Problem solving with Unix commands by jfk13 on Thursday February 14, 2019 @08:56AM (#19161847)
That might not always do what a naïve user expects:

    $ printf '%d\n' "0025"
    21
Re:Problem solving with Unix commands by inp on Thursday February 14, 2019 @07:28AM (#19161361)
You can apply the awk command on a pipe, and so it is applies on each line of the file/stream.
Re:Problem solving with Unix commands by darrenf on Thursday February 14, 2019 @09:01AM (#19161888)
Right - though that's solvable with xargs:

    $ echo "0005" | xargs printf '%d\n'
    5
That said, my suggestion doesn't work anyway since the leading 0 marks it as octal, d'oh (as mentioned elsewhere in the thread).