glenn jackman

Ottawa, Canada

Developer at Pythian.
Big Tcl and Perl fan.
Enjoy Ruby and JavaScript too.

1h
comment Why does the printf statement in this loop output the array out of sequence?
Associative arrays have no inherent order. The insertion order is not preserved.
9h
answered Insert space at specified position in a file
9h
comment gawk in windows 7 doen´t handle spaces properly
But if this at a Windows cmd prompt, you'll want gawk "{print $1}" file -- I don't think single quotes are that special for windows.
9h
answered Pulling data off of a telnet connection while simultaneously running shell script
10h
comment Adding character just to end and beginning of file in shell
How crucial are the leading spaces?
10h
revised Adding character just to end and beginning of file in shell
a missed requirement.
10h
comment How to split data with awk
You can use print "" in place of printf("\n") -- a little tidier.
10h
comment Reload bash_profile after script has ended
Then I don't see that you have a choice except to manually source it.
10h
comment inotify + stdout piping - output being lost in a pipe
"Most commands"? Doubt it. For example, perl's documentation says: "STDOUT will typically be line buffered if output is to the terminal and block buffered otherwise.", which is demonstrated as the differences between perl -E 'say "one"; sleep 3; say "two"' and perl -E 'say "one"; sleep 3; say "two"' | cat and perl -E '$|=1; say "one"; sleep 3; say "two"' | cat
12h
answered inotify + stdout piping - output being lost in a pipe
12h
answered Reload bash_profile after script has ended
12h
revised error "0: command not found" on a comment line
formatting for emphasis
12h
answered Reverse a default flag
16h
answered Check if a number exists in between a set of two numbers in another file and return output accordingly in a shell script
1d
comment Bash - Find variable in many .txt files and calculate statistics
You can do away with sed and grep altogether
1d
revised Bash - Find variable in many .txt files and calculate statistics
added 549 characters in body
1d
comment Bash - Find variable in many .txt files and calculate statistics
If you use \K, you don't need the look-behind. grep ... "${varName}\s*=\s*\K[\d]+\.?[\d]*" -- may have to double the backslashes in double quotes
1d
revised Truncate middle of piped text and replace with ellipsis in one command
added 266 characters in body
1d
answered Truncate middle of piped text and replace with ellipsis in one command
1d
awarded Explainer
1 2 3 4 5