Yes
Often people use bash when they actually mean command-line – I bet that's what terdon had in mind when he asked about it.
Unless OP explicitly states they need a pure bash
solution, answers using external tools like awk
, sed
and also python
are welcome and regularly accepted in the end. And even then: Answers are not for OP alone, but for everybody with the same question. If something else than pure bash
is in any way useful to solve the problem. then it's suitable for an answer.
After all, there are few who actually know what is a bash
builtin and what's not – a regular Ubuntu user deliberately doesn't have to care about things like that. (There's type
to determine that, compare the output of type -a read
with that of type -a ls
.)
By the way, of the three answers there only one uses bash
builtins, and one of the others is by a moderator (watch out for the diamond symbol ♦) – if in doubt, do what terdon ♦ or any other moderator does.
python
I'm eagerly awaiting your answer there now. ;)