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

> I didn't realize Zsh (and Bash) was capable of removing zero padding in that way.

Well, it's for transforming an integer in a different bases like octal, binary until base 24 (or more don't recall), but it can be abused to strip padding zeroes from variables. Using printf should probably be cleaner but usually I only recall the the C syntax...

I think I have parallel installed but I tend to use xargs out of habit, mostly because I was forced to use xargs in locked out production systems.

If the number of files wouldn't be so big, I'd simply expand them on ls and capture stderr:

    ls {0001..0500}_A.csv 1> /dev/null
It's a little nosier with the error messages but it's fast. With 500 files I'm sure I'll exhaust the shell parse(?) buffer:

    (ls {0001..0500}_A.csv 2>&1 1> /dev/null) | awk -F\' '{print $2}'
and too much complications to suppress stdout and pipe only stderr. ^__^;


Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: