Reputation
12,829
Top tag
Next privilege 15,000 Rep.
Protect questions
Badges
7 51 105
Impact
~1.0m people reached

1h
awarded  Nice Question
1h
comment Need output in a good format using shell script
It needs a bit of tweaking: { head -n 1; column -s, -t; } <file
1h
comment Need output in a good format using shell script
Do you need the numbers right justified? (I couldn't tell from your original presentation, so when I edited your question, I left justified them)
1h
revised Need output in a good format using shell script
Make it simple to read and understand
1d
comment lines to columns with awk
The output is not correct – column -t, by default, uses one-to-many spaces as its column separator – this results in the OS values being split into 2 columns.
1d
revised lines to columns with awk
deleted 10 characters in body
1d
revised lines to columns with awk
fixed previous limitation of the problematic `>`
1d
revised lines to columns with awk
missing `/` in OS end tag in test data
1d
revised lines to columns with awk
missing `/` in OS end tag in test data
1d
revised lines to columns with awk
fixed missing `/` in end tag - damn thing thew me off track (testing)
1d
answered lines to columns with awk
1d
comment lines to columns with awk
"arbitrarily set each colmn (width)" means that you will arbitrarily get whacky output.
1d
comment lines to columns with awk
Instead of creaitng another file to accomodate the DATA tag, just pipe the extra tags, along with the html output, into xmlstarlet, eg.: { echo '<DATA>'; cat html-file; echo '</DATA>'; } | xmlstarlet … - where cat html-file may be a program vs. a file.
2d
comment Conditional if clause in awk
The grep version doesn't adequately identify the fields. eg it should (but doesn't) output lines such as: foo,21000,boo,A, foo,1000,boo,ZA, foo,1000,boA,C
Aug
25
comment Appending One File to the Second Until End of File
Ok, point taken. In that case, $(head -n1 file1) would be equivalent to the read -r method, and thereby safer than either $(cat file1) or $(<file1). Nonetheless, all these methods (includingread -r) are subject to the escape-sequence interpretation. – However, that being said, all 4 methods are fine, if the data is as per the stated specs.
Aug
25
comment Appending One File to the Second Until End of File
When you say, "read file1 for each line in file2 it is not good idea", are you referring to other sed answers wihch use $(cat file1) within a sed expression? If so, then, it is worth noting that $(cat file1) is expanded by the shell on the command line so sed gets a literal value. – Also, what is more secure about using read -r? Though the -r disables backshash(escape) sequence translation, a variable containing a backslash would be interpreted as an escape character (unless it was embedded in a character range expression, eg. [abc\].
Aug
25
comment Using rename in the terminal to remove not accepted Windows characters
... Actually, the full chain of links for rename is: /usr/bin/rename /etc/alternatives/rename /usr/bin/prename
Aug
25
comment Using rename in the terminal to remove not accepted Windows characters
Different distros can use different rename tools; rename can be link to a perl script,prename – you can check which tool is actually run by running readlink -e "$(which rename)" in the terminal. my Ubuntu outputs: /usr/bin/prename. The executables rename and prename are quite different.
Aug
25
comment How can I make the `cal` tool in OSX highlight the current day?
or: cal | grep -E --color "(\b$(date +%d)\b|$)"
Aug
24
comment How to suppress exit code of finished background jobs
or: sleep 5 & disown