top | item 19161335

(no title)

inp | 7 years ago

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}'"

discuss

order

tyingq|7 years ago

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.

darrenf|7 years ago

Why even use awk rather than the shell's (well, bash's) builtin printf?

    $ printf '%d\n' "0005"
    5

jfk13|7 years ago

That might not always do what a naïve user expects:

    $ printf '%d\n' "0025"
    21

inp|7 years ago

You can apply the awk command on a pipe, and so it is applies on each line of the file/stream.