New answers tagged


help running provides some hints: There are step and next instuctions (and also nexti and stepi). (gdb) help next Step program, proceeding through subroutine calls. Usage: next [N] Unlike "step", if the current source line calls a subroutine, this command does not enter the subroutine, but instead steps over the call, in effect treating it as a single ...


We can walk or swim anywhere, so why do we bother with bicycles, cars, trains, boats, planes and other vehicles? Sure, walking or swimming can be tiring, but there is a huge advantage in not needed any extra equipment. For one thing, although bash is Turing-complete, it is not good at manipulating data other than integers (not too large), strings, (one-...


it seems Bash is a Turing-complete language The concept of Turing completeness is entirely separate from many other concepts useful in a language for programming in the large: usability, expressiveness, understandabilty, speed, etc. If Turing-completeness were all we required, we wouldn't have any programming languages at all, not even assembly language. ...


Some reasons not to use shell scripts for large programs, just off the top of my head: Most functions are done by forking off external commands, which is slow. In contrast, programming languages like Perl can do the equivalent of mkdir or grep internally. There's no easy way to access C libraries, or make direct system calls, which means that e.g. the ...


In increasing order of helpfulness: if you identify a bug, report it with as much relevant information as possible (to make it easy for the maintainers to reproduce and then fix). If you can read the source and identify where the bug occurs, include that information. If you are able to provide a patch that fixes the bug, include that (or open a pull ...


Cut the columns into two sets, one with the first column and the other one with column two and three. Transliterate the characters into digits in the second of these sets. Paste everything together again. On the command line: $ cat data Id_animal / Column1 / Column2 ID01 / A / B ID02 / B / A ID03 / C / A ID04 / A / G ABCG / G / G $ paste -d '/' <(cut -...


With perl you can apply trasnliterations to specific input colums using a map e.g. perl -F"/" -alne 'print join "/", @F[0], map { tr/ABCG/1234/; $_ } @F[1,2]' input For example, given input Id_animal / Column1 / Column2 ID01 / A / B ID02 / B / A AG02 / B / A ID03 / C / A ID04 / A / G then $ perl -F"/" -alne 'print $. == 1? $_ : join "/", @F[0], map { ...


Under the assumption that you only want to translate A, B, C, and G to 1, 2, 3, and 4, and that the first column never contains those letters, you could simplify bgStack15's answer to just: tr 'ABCG' '1234' < input > output


Adjust the variables as desired. Save this to a file, for example `/home/Amanda/ #!/bin/sh infile=~/input.txt outfile=~/output.txt while read one two; do printf "%s %s\n" "${one}" "$( echo "${two}" | tr 'ABCG' '1234' )" done < ${infile} > ${outfile} Be sure to make the script executable: chmod +x /home/Amanda/


String multiplication trick based on this answer: Use substitution to insert programmable number of dashes paste $(for i in {1..400}; do echo -n '- '; done) or paste $(printf -- "- %.s" {1..400}) To know why printf -- was used: Dashes in printf


For a file with 4 rows: paste $(for((i=1;i<4;i++)); do echo -n "- "; done; echo -n "-") < file

Top 50 recent answers are included