Reputation
118,880
Next tag badge:
98/100 score
37/20 answers
Badges
19 150 297
Newest
 Nice Answer
Impact
~4.8m people reached

Jun
14
answered How to use regex to match a pattern which does not have a specific string at the end
Jun
14
revised How to use regex to match a pattern which does not have a specific string at the end
missing -d and -- when using globs, those globs are also supported by zsh when in ksh emulation, though zsh has its own ^*bak for that.
Jun
14
comment How to use regex to match a pattern which does not have a specific string at the end
POSIX BREs have no \|.
Jun
14
comment Filter file by line number
@mikeserv, ah! of course with your approach, the locale makes a difference. Down from 4.5s to 2.3s here when switching from UFT-8 to C.
Jun
14
comment Filter file by line number
@mikeserv, we must have different awks. On your sample, I get 1.4s with gawk (4s for Janis'), 0.9s with mawk, 1.7s with this perl solution, 2.3s with kos', 4.5s with yours (GNU sed), and 1.4s with yours (GNU sed) and my suggested improvement (and 0.5s for the C solution).
Jun
14
comment Filter file by line number
@Janis, actually factorising code by using functions incurs a significant performance cost here.
Jun
14
comment Filter file by line number
You can make it significantly faster (almost as quick as mine on multi-core systems) with sed -ne'/:/!{n;p;}' | cut -d: -f2- instead of sed -ne'/:/!N;/\n/s/[^:]*://p'
Jun
14
awarded  Nice Answer
Jun
13
revised Does sharing SID by processes *always* imply their shared PGID?
deleted 2 characters in body
Jun
13
revised Does sharing SID by processes *always* imply their shared PGID?
added 366 characters in body
Jun
13
comment Does sharing SID by processes *always* imply their shared PGID?
@dziadek1990. The controlling terminal if any. Sessions are also used for automatic signal delivery in some circumstancies.
Jun
13
comment Filter file by line number
@terdon, Yes, a shame that join/comm can't work with numerically sorted input.
Jun
13
answered Does sharing SID by processes *always* imply their shared PGID?
Jun
13
answered How to set HOSTNAME in zsh?
Jun
13
comment How to set HOSTNAME in zsh?
uname -n would be a better bet.
Jun
13
comment Filter file by line number
@Janis, the idea was that if that code was to be embedded in a command-in-question script, then you can't have the filename embbed in the code. -v list="$opt_x" doesn't work either because of the backslash-prcessing done by awk on it. Which is why I use ENVIRON instead here.
Jun
13
comment Filter file by line number
@Peter.O, oops, that's what I had tried to address with by NR>=n, but that was wrong. Should be better now.
Jun
13
revised Filter file by line number
added 135 characters in body
Jun
13
answered Filter file by line number
Jun
12
comment Bash script: check if a file is a text file
You cannot rely on substrings in the output of file as for many formats file extracts and displays strings from the file (look for %s in the magic sources) which may include text