Peter.O

Australia

Age: 64

No, I don't know what orthogonal means.

3h
comment Regex search for word roots with common prefixes
The combination of grep and sed is rather unnecessary, as sed can do both steps in one: sed -nr 's/^(pro|con)(.*)/\2/p' | sort | uniq -d
7h
awarded Enlightened
8h
awarded Nice Answer
11h
revised Grep the text which matches with a pattern
handle trailing newline properly - ie don't print `\n` when no matches found
13h
revised Grep the text which matches with a pattern
to add newline
13h
revised Grep the text which matches with a pattern
added 13 characters in body
14h
revised Grep the text which matches with a pattern
added 82 characters in body
14h
answered Grep the text which matches with a pattern
22h
comment How to add argument options to executables in C
Your question is vague and broad. Are you asking - "What are the convention guidlines?" If so, you could start here The Open Group Base Specifications Issue 7 - Utility Conventions
1d
comment Bash error: missing [: missing `]'
@PeterRoberts: The "discard" syndrome (as you put it) is (as I see it) the result of a frustration coming from many people coming here for the first time and asking poorly prepared, inadequate questions. Think of it as a rite of passage - If you can take the (initial) heat, you will soon learn the flow and way of doing things here - It is a very practical, effective, and helpful site - To inform yourself of the way to present questions and answers and comments, read the Help Center page
1d
comment Average of multiple files in shell
I don't know if it is just a GNU awk thing (which I use), but the value of FNR and NF is still valid in the END{ } block - so that would save the need to handle those vars separately (in GNU awk at least) . +1
1d
answered Bash error: missing [: missing `]'
1d
comment Bash error: missing [: missing `]'
Are the files usage1 and /home/peters/usage1 the same file? I assumer they are (but I'm not sure.. it is a bit odd either way) -- It seems that you can check it in one line: [[ -n $(df -h / | awk 'int($5)>6{print $5}') ]] && echo "Warning file system greater than 6%"
1d
revised How do you use variables with values containing spaces in a Z-shell (zsh) script command?
another way to present the array
2d
answered How do you use variables with values containing spaces in a Z-shell (zsh) script command?
2d
comment XXD output without line breaks
It depends on what you need it for, but one handy option of xxd is that it ignores whitespace for the reverse -r of its postcript/plain -p dump (or any plain hexdump for that matter). eg. The following line wraps with \n, but the reversed output is exactly what was input: echo {1..14} | xxd -p | xxd -p -r produces output: 1 2 3 4 5 6 7 8 9 10 11 12 13 14\n – the \n is from the echo
Jul
25
comment What does the horizontal space or width mean in the monospaced font?
Simply put, a character (in a font) is not just the black/visible part; it also includes a rectangle of space around it. In proportional fonts that rectangle's width varies according to the particular letter. In monspace fonts, that rectangle is the same width for each and every character. This means that each of 10 monospaced . (dots) will line up vertically with 10 monospaced M characters - each monospace character takes up the same horizontal space on a line - whereas 10 porportional font dots will take up significantly less horizontal space that 10 proportional font M characters.
Jul
24
comment Remove lines from file up to a pattern, unless the pattern doesn't exist
I've now abandoned sed in favour of awk (plus cat when no match) ...
Jul
24
revised Remove lines from file up to a pattern, unless the pattern doesn't exist
a complete re-do
Jul
24
revised Remove lines from file up to a pattern, unless the pattern doesn't exist
added to description
1 2 3 4 5