New answers tagged

0

You can use Vim in Ex mode: ex -sc 'g/Baboon/s/$/\t5/' -cx file g global regex s substitute x save and close


0

You can use Vim in Ex mode: ex -sc '%s/$/\tgreen/|x' test.txt % select all lines \t tab x save and close


2

do not mistake a = b and a == b even with if ( ) test, a = b is setting b's value to a. (even if a is $3). you should write : $3 == 1


4

With awk: awk '{for(i=1;i<=NF;i++){for(j=i+1;j<=NF;j++){print $i$j;}}}' file It's two nested for loops: for(i=1;i<=NF;i++) loop trough all fields for(j=i+1;j<=NF;j++) then for each field, loop trough all remaining fields (start at i+1) print $i$j print both field values. The output: AB AC AD BC BD CD



Top 50 recent answers are included