10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to print field and the next one if field matches 'patternA' and also print 'patternB' fields.
echo "some output" | awk '{for(i=1;i<=NF;i++){if($i ~ /patternA/){print $i, $(i+1)}elif($i ~ /patternB/){print $i}}}'
This code returnes me 'syntax error'. Pls advise how to do properly. (2 Replies)
Discussion started by: urello
2 Replies
2. UNIX for Beginners Questions & Answers
Hi, I have two TEST files t.xyz and a.xyz which have three columns each. a.xyz have more rows than t.xyz. I will like to output rows at which $1 and $2 of t.xyz match $1 and $2 of a.xyz. Total number of output rows should be equal to that of t.xyz.
It works fine, but when I apply it to large... (6 Replies)
Discussion started by: geomarine
6 Replies
3. Shell Programming and Scripting
In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
Discussion started by: cmccabe
0 Replies
4. Shell Programming and Scripting
Trying to combine the matching $5 values between file1 and file2. If a match is found then the last $6 value in the match and the sum of $7 are outputted to a new file. The awk below I hope is a good start. Thank you :).
file1
chr12 9221325 9221448 chr12:9221325-9221448 A2M 1... (5 Replies)
Discussion started by: cmccabe
5 Replies
5. Shell Programming and Scripting
For an Output like below
Input : <Subject A="I" B="1039502" C="2015-06-30" D="010101010101">
Output : <Subject D="010101010101" B="1039502" C="2015-06-30" A="I">
I have been using something like below but not getting the desired output :
awk -F ' ' '/Subject/ BEGIN{OFS=" ";}... (19 Replies)
Discussion started by: arunkesi
19 Replies
6. Shell Programming and Scripting
Not sure quite how to do this, but I am trying to use $1 of LCH.txt (exact match) to look for a match in $1 of genes.txt. If a match is found then in a new file match.txt $1 $2 ($4-$3) are copied.
Example, the first record in LCH is PPT1 and that matches row 713, column 1 of genes.txt.
... (2 Replies)
Discussion started by: cmccabe
2 Replies
7. Shell Programming and Scripting
Hi everybody (first time posting here)
I have a file1 that looks like >
1,101,0.1,0.1
1,26,0.1,0.1
1,3,0.1,0.1
1,97,0.5,0.5
1,98,8.1,0.218919
1,99,6.2,0.248
2,101,0.1,0.1
2,24,3.1,0.147619
2,25,23.5,0.559524
2,26,34,0.723404with 762 lines..
I have another 'similar' file2 >
... (10 Replies)
Discussion started by: murpholinox
10 Replies
8. Shell Programming and Scripting
Howdy!
I have multiple files with tab-separated data:
File1_filtered.txt
gnl|Amel_4.0|Group3.29 1 G R 42 42 60 15 ,.AAA.aa,aa.A.. hh00/f//hD/h/hh
gnl|Amel_4.0|Group3.29 2 C Y 36 36 60 5 T.,T, LggJh
gnl|Amel_4.0|Group3.29 3 A R 27 27 60 9 Gg,,.gg., B6hcc22_c
File2_filtered.txt
... (3 Replies)
Discussion started by: sramirez
3 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I need help on appending certain field in my file1.txt based on matched patterns in file2.txt using awk or sed.
The blue color need to match with one of the data in field $2 in file2.txt. If match, BEGIN and FINISHED value in red will have a new value from field $3 and $4 accordingly.
... (1 Reply)
Discussion started by: redse171
1 Replies
10. Shell Programming and Scripting
I have two files that have the date field in common. I request your help with some script that divide each field value from file1 by the correspond field value of the file2 only when the field date is equal in both files. Thanks in advance !
This is a sample of the files
file 1
12/16/2010,... (2 Replies)
Discussion started by: csierra
2 Replies
xchain(6) Games Manual xchain(6)
NAME
xchain - Chain Reaction, Strategy game for 2-4 players
SYNOPSIS
xchain [-v] [--version] [-h] [--help] [path to wish]
DESCRIPTION
Rules of the game
Chain Reaction is played on an 8 by 8 board. Players take turns to move. On each move, the player may select an empty square, or one they
already own. Squares belonging to other players may not be chosen. If the square was unowned, it becomes the property of the player, and
is given a value of 1. If the square was owned by the player, the value is incremented.
If the value of a square ever exceeds the maximum permitted of that square, it explodes. Squares in the corner have a maximum of 1, squares
touching an edge, but not on a corner have a maximum of 2, and squares in the interior have a maximum of 3.
When a square explodes, it becomes unowned, and it's value is reset to 0. The 4 squares touching it become owned by the owner of the
exploding square, and their values are incremented. If any of these are above their maximum, they explode, giving rise to the chain reac-
tion.
If, at the end of a move, any of the players have no squares, they are dead, and get no more turns. When there is only one person left,
they are the winner.
Game options
On loading the game, a 2 player game with a blank board is loaded. To change this, edit the settings to suit, and click on "New Game".
Clicking on this in the middle of a game will abandon it, and start a new one.
To select the number of players, click on the numbered radio buttons. To the right of these are entry boxes to fill in player names, if
desired. The background to these shows the colour of the players' squares. Names and colours are only updated when "New Game" is clicked
on. To the right of these, are counters of the number of squares belonging to each player.
If a shorter game is desired, squares can be set for the players before the game starts. This can be up to 4 rows and columns, or a random
placement. For 2 players, up to 32 squares each may be chosen. For 3 players, up to 21 each, and for 4 players, up to 16 each.
Whoever goes first has quite an advantage. To offset this, a random first person can be chosen. On clicking "New game", the status bar
below the board shows who this will be.
OPTIONS
-h, --help
Show summary of options.
-v, --version
Show version of program.
path to wish
Chain Reaction requires the wish tcl/tk interpreter. By default it uses /usr/bin/wish (The default for Debian GNU/Linux, and most
other Unix-like systems). Use this option to force a different location.
FILES
/usr/bin/wish
Default location of wish tcl/tk interpreter.
BUGS
Not guaranteed to be free of potential buffer overflows. Do not use setuid, or with greater privilege than the players using it.
WISH LIST
Network support.
A way to save game settings - either environment variables, or a settings file.
HISTORY
First seen many years ago on the (as it was then) Acorn Archimedes. Original author unknown. Written for Unix by Alistair Cunningham
<ac212@cam.ac.uk>
http://thor.cam.ac.uk/~ac212/xchain/
xchain(6)