Skip to content

Tag: bash

Using netcat to issue a http get request in bash

I have written the following script (it does not support index yet). The issue I am having is regarding using netcat to load the page. I can do this manually using the command line but when I try to have my script issue the exact same commands I can it does nothing without error. The only possible thing I can

Keep zero after Hexdecimal conversion in bash

I’m writing a very simple script in bash: I want to print all numbers with minimum three digits as 000, 001, 002 .. until 099. With integer numbers it works good, but after obase = 16; $ i ‘| bcs number return with one or two digits. How can I solve it in the easiest way? Answer You might want

How to change *** to textbf with sed

I export results from my analysis into a table in Latex. I would like to be able to change all coefficients that are significant to ***, **, * to bold face text textbf. This requires me to search with sed and change the stars to wrap around the coefficient. I want to change 0.047$^{***}$ to textbf{0.047} I&#8…

advanced printf explanation in bash

I just found this programming segment in my son’s Bash file. I am quite a newbie and unable to understand the printf syntax. Can someone explain me the COMMENTED printf in the segment below?? Answer It’s is nothing but a busy/wait spinner and the lines commented do nothing but set a blue foregroun…

Sorting an array of dates in bash

I want to sort an array of dates. Example format: “2017-11-13_07-55-40” or Year-Month-Date_Hour-Minute-Second Answer Since your dates are already in YYYY-MM-DD-HH-MM-SS format, you can use numeric sort: To store output in another array use: