Sponsored Content
Top Forums Shell Programming and Scripting awk to split one field and print the last two fields within the split part. Post 302624829 by yifangt on Tuesday 17th of April 2012 12:02:15 AM
Old 04-17-2012
Awesome!
I made the simple thing complicate. Your script is much simpler than mine. Lots to learn! Thanks a lot!
Yifang
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split a field in awk script

Hi all, I have a field in the line, let's say argument $6, which is in the format 00.00 If i want to split the field to get rid of the "." in between of the amount, how can i do that i awk script? I have it like this split($6,a,".") but it will get rid of the last 2 digits after the... (4 Replies)
Discussion started by: CamTu
4 Replies

2. Shell Programming and Scripting

can Awk split my field on the .

I am trying to pull data out of a file to execute a series of repetitive commands. One of the fields is a {hex number}.{hex number} pattern. I need the first part of that structure to pass into the command. The file structure is like this: A 2007/10/20 09:50:00 li text ef6da.1 name ... (6 Replies)
Discussion started by: oly_r
6 Replies

3. Shell Programming and Scripting

How to split a field into two fields?

Hi, I have a comma delimited text file where character fields (as opposed to numeric and date fields) are always enclosed with double quotes. Records are separated by the newline character. In a shell script I would like to split a particular field into two separate fields (enclosed with double... (4 Replies)
Discussion started by: vbrown
4 Replies

4. Shell Programming and Scripting

Split field with awk

Hi there I have a text file with several fields separated by ";" as follow : 5466-43;5466;JOAN;LIGA;LIGA ESPANOLA;43;DEP LA CORUNA - OSASUNA;10/01/10 17:00 5466-44;5466;CARLES;LIGA;LIGA ESPANOLA;44;MALAGA - ATHL BILBAO;10/01/10 17:00 5466-45;5466;FAB;LIGA;LIGA ESPANOLA;45;REAL MADRID -... (4 Replies)
Discussion started by: capnino
4 Replies

5. Shell Programming and Scripting

AWK:Split fields separated by semicolon

Hi all, I have a .vcf file which contains 8 coulmns and the data under each column as shown below, CHROM POS ID REF ALT QUAL FILTER INFO 1 3000012 . A G 126 ... (6 Replies)
Discussion started by: mehar
6 Replies

6. Shell Programming and Scripting

awk split lines without knowing the number of fields a-priori

I want to use awk to split fields and put them into a file but I don't know the number of fields for example, in the following line Ports: 22/filtered/tcp//ssh///, 53/open/tcp//tcpwrapped///, 111/filtered/tcp//rpcbind///, 543/filtered/tcp//klogin///, 544/filtered/tcp//kshell///,... (3 Replies)
Discussion started by: esolvepolito
3 Replies

7. Shell Programming and Scripting

How to print 1st field and last 2 fields together and the rest of the fields after it using awk?

Hi experts, I need to print the first field first then last two fields should come next and then i need to print rest of the fields. Input : a1,abc,jsd,fhf,fkk,b1,b2 a2,acb,dfg,ghj,b3,c4 a3,djf,wdjg,fkg,dff,ggk,d4,d5 Expected output: a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
Discussion started by: 100bees
6 Replies

8. Shell Programming and Scripting

awk split after second underscore in field

I am trying to split a tab-delimeted file using awk after the second _ in bold. The awk below is close but splits on the first _, and I am not sure how to use the second _. Thank you :). file chr1 92145889 92149424 NM_001195684_exon_0_10_chr1_92145900_r 0 - chr1 92161218 ... (4 Replies)
Discussion started by: cmccabe
4 Replies

9. Shell Programming and Scripting

awk to add plus or minus to fields and split another field

In the tab-delimited input below I am trying to use awk to -10 from $2 and +10 to $3. Something like awk -F'\t' -v OFS='\t' -v s=10 '{split($4,a,":"); print $1,$2-s,$3+s,a,$5,$6} | awk {split(a,b,"-"); print $1,$2-s,$3+s,b-s,b+s,$5,$6}' input should do that. I also need to -10 from $4... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. UNIX for Beginners Questions & Answers

awk to split field twice using two deliminators

In the awk I am splitting on the : into array a, then splitting on the - into element b. I can not seem to duplicate b if there is no - after it. Lines 1,2,4 are examples. If there is a - after the number in b then the value to the right of it is $3 in the ouput. Thank you :). awk... (2 Replies)
Discussion started by: cmccabe
2 Replies
XDEMINEUR(6x)															     XDEMINEUR(6x)

NAME
xdemineur - X11 minesweeper game SYNOPSIS
xdemineur [-v] [-display displayname] [-geometry geom] [-m mines] DESCRIPTION
Xdemineur is a minesweeper game for the X Window System. The object of this game is to find the location of the mines hidden in the minefield and to mark their location by placing a warning flag. You have exactly as many flags as there are mines. The number of flags that remain to be placed is displayed in the top left corner of the window and a timer is displayed in the top right corner. The game is played using a three buttons mouse, as usual with the X Window System. The left button (button 1) is used to uncover the square on which you click (hoping that a mine is not hidden there). The number displayed in an uncovered square indicates how many mines are located around this square (for example, a 3 means that there are three mines within the 8 surrounding squares). The whole game relies on the right use of these numbers. The right button (button 3) is used to place a flag on a square (this indicates that there is a mine here). If you click again with the right button on a square that has a flag, the flag is changed into a question mark: this is useful if you are trying to guess the possible location of some mine, you can use question marks to think about it. One more click with the right button and the question mark disappears. Clicking with the middle button (button 2) on an uncovered square which has all its flags placed around uncovers the surrounding cells which have no flags (this will save a lot of time). Finally, to start a new game, just click on the yellow face above the minefield. OPTIONS
-v Print out version number and copyright notice then exit. -display displayname This option specifies the name of the X server to use. See X(1). -geometry geom This option specifies the initial size and location of the window. See X(1). The size is expressed in number of columns times num- ber of rows. The default is 30x16. The minimum number of columns is 12. -m mines This option specifies the number of mines in the minefield. If there are more mines than squares in the minefield, the default mine number is used. BUGS
Please report any bug you could find in xdemineur to <babafou@babafou.eu.org>. Also, you should tell me the customizations you may have done, such as adding new functions to the game or making modifications to allow the game to run on your system. COPYRIGHT
Copyright (C) 1993-1999 Marc Baudoin <babafou@babafou.eu.org> Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, pro- vided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in sup- porting documentation. The author makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. AUTHOR
Marc Baudoin <babafou@babafou.eu.org> XDEMINEUR(6x)
All times are GMT -4. The time now is 04:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy