Sponsored Content
Full Discussion: looping and awk/sed help
Top Forums Shell Programming and Scripting looping and awk/sed help Post 76511 by Zelp on Tuesday 28th of June 2005 04:42:25 PM
Old 06-28-2005
Thanks again, you are really on the ball!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Looping in awk

Can somebody give me a cleaner way of writing the following script. I was thinking that I could use a loop in the awk statement. It works fine the way it is but I just want the script to be cleaner. #!/usr/bin/sh for r in 0 1 2 3 4 5 6 do DAY=`gdate --date="${r} days ago" +%m\/%d\/%y`... (3 Replies)
Discussion started by: keelba
3 Replies

2. Shell Programming and Scripting

Awk: looping problem!

I am having a problem with awk when I run it with a loop. It works perfectly when I echo a single line from the commandline. For example: echo 'MFG009 9153852832' | awk '$2 ~ /^0-9]$/{print $2}' The Awk command above will print field 2 if field 2 matches 10 digits, but when I run the loop... (5 Replies)
Discussion started by: cstovall
5 Replies

3. Shell Programming and Scripting

Looping and using Sed

Hi guys I having som problem trying to use sed to get a file and insert inside another one. I'll try to explain better. I have a base.txt and using sed(having a array variables) I'm chaging some strings inside this file and saving as base1.txt. until here okay. Then, I have to get this... (4 Replies)
Discussion started by: digobh
4 Replies

4. UNIX for Dummies Questions & Answers

Help with AWK looping

I'm trying to parse a configuration text file using awk. The following is a sample from the file I'm searching. I can retrieve the formula and recipe names easily but now I want to take it one step farther. In addition to the formula name, I would like to also get the value of the attribute... (6 Replies)
Discussion started by: new2awk
6 Replies

5. Shell Programming and Scripting

Sed pattern space/looping conundrum

Although my sed skills are gradually developing, thanks in large part to this forum, I'm having a hard time dealing with pattern space and looping, which I suspect is what I'll need a better handle on to figure out my current issue, which is converting a multi line file like this: ... (4 Replies)
Discussion started by: tiggyboo
4 Replies

6. Shell Programming and Scripting

looping in awk

How do I remove last comma? echo "xx yy zz" | awk 'BEGIN{FS=" "}{for (i=1; i<=NF; i++) printf "%s,", $i}'output: xx,yy,zz, required output: xx,yy,zz or (ideally!): xx, yy & zz many thanks in advance! (4 Replies)
Discussion started by: euval
4 Replies

7. Shell Programming and Scripting

AWK looping over 2 variables

I would like to loop over variables i and j consecutively, { a = -6.7 b = 7.0 c =0.1 { for (i = 0; i<=(b-a)/c; i++) for (j = 1; j<=(b-a)/c; j++) '$1<=(a+j*c)&&$1>=(a+i*c)' FILENAME > output_j '{print $2}' output_j > output_j_f } I essentially want to print the range of $1... (9 Replies)
Discussion started by: chrisjorg
9 Replies

8. Shell Programming and Scripting

Help on looping using awk

I have the data like this: PONUMBER,SUPPLIER,LINEITEM,SPLITLINE,LINEAMOUNT,CURRENCY IR5555,Supplier1,1,1,83.1,USD IR5555,Supplier1,1,3,40.4,USD IR5555,Supplier1,1,6,54.1,USD IR5555,Supplier1,1,8,75.1,USD IR5556,Supplier2,1,1,41.1,USD IR5556,Supplier2,1,3,43.1,USD ... (3 Replies)
Discussion started by: jeffreybsu
3 Replies

9. UNIX for Beginners Questions & Answers

Looping and sed

Hi, I've got text files (say file1 and file2) in a directory (say directory1) with several columns like this: a b c d a b c de f g h e f g hI need to add a header to the files in directory1 and the names of the columns must contain an identifier from another text file (say file3) like this:... (4 Replies)
Discussion started by: zajtat
4 Replies

10. Shell Programming and Scripting

awk nested looping?

I am trying to parse a text file and send its output to another file but I am having trouble conceptualizing how I am supposed to do this in awk. The text file has a organization like so: Name Date Status Location (city, state, zip fields) Where each of these is on a separate line in... (1 Reply)
Discussion started by: kellyanneghj
1 Replies
GTKBALLS(6x)															      GTKBALLS(6x)

NAME
gtkballs - A simple logic game SYNOPSIS
gtkballs [options] DESCRIPTION
This manual page documents GtkBalls. GtkBalls is a simple logic game. The goal of this game is to make the highest score by matching a number of balls of the same color in a horizontal, vertical or diagonal line. For further information on how to play this game refer to the rules section in this manual page. OPTIONS
--display [hostname:dpy] Specify what display GtkBalls should use. See X(1x) for more information on the syntax of hostname and display. RULES
The standard play area of GtkBalls is a 9x9 grid (it can be changed through "Rules" option in ingame menu). When GtkBalls is first started a number of balls are placed in a random manner on the grid. Balls are in different colors (and/or shape). You may move balls on the grid by selecting them and selecting an empty square on the grid as destination for the ball you selected. Balls will only move if they are not blocked by other balls. Each time you move a ball, unless you score some points, new balls appear in a random manner on the grid. If the grid is full then the game is lost. However this is bound to happen, your goal is to make the highest score. In order to do this you must make lines in a vertical, horizontal or diagonal way with balls of the same color. By default a line must have at least five balls of the same color (it can also be changed through "Rules" option in ingame menu). Making a line of minimum amount of the balls, specifed in rules, will earn you twice the points for your score. If you make lines over minimum amount of the balls it will earn you even more points. In order to help you decide which ball you are going to move, there is an indicator on top of the grid that shows what colors the next balls that will appear on the grid will be. USING THE INTERFACE
GtkBalls is a graphical program using the Gtk+ windowing toolkit. This section describes it's user interface. THE GAME MENU New Selecting this menu entry will abandon the current game and start a new one or start another game if you just finished one. You may use the keyboard shortcut CTRL-N to do this also. Rules Selecting this menu entry will open "Rules" dialog box, where you can set board width and height, number of different objects to appear on the board, number of objects that will appear on the board after each turn and number of objects that must form the line to eliminate it. You may use the keyboard shortcut CTRL-R to do this also. Save Selecting this menu entry will open "Save game" dialog box, where you can save current game to play it later. You may use the key- board shortcut CTRL-S to do this also. Load Selecting this menu entry will open "Load game" dialog box, where you can load previously saved game. You may use the keyboard shortcut CTRL-L to do this also. Hall Of Fame Selecting this menu entry will open a dialog box showing the high scores. Only the ten best scores are shown. This dialog also dis- plays the name of the person who achieved a high score and it's date. You may use the keyboard shortcut CTRL-H to do this also. Quit Selecting this menu entry will quit GtkBalls. You may use the keyboard shortcut CTRL-Q to do the same thing. THE EDIT MENU Undo Selecting this menu entry will undo your last move. You may use the keyboard shortcut CTRL-U to do this also. THE SETTINGS MENU Preferences Selecting this menu entry will open the "Preferences" dialog box. You may use the keyboard shortcut CTRL-P to open it also. This dialog box allows you to set some options. Click on a check box to activate or deactivate them. Click on the theme name to select it. Then click on the Apply button to save your settings or click on Ok button to save your settings and close this dialog box. You can disable the showing of footprints, path of the ball, color of the next balls indicator, animation of disappearing of the ball and set time limit per move from this dialog box. THE HELP MENU Rules Selecting this menu entry will display a dialog box describing rules of the game. You may use the keyboard shortcut F1 to open it also. About Selecting this menu entry will display a dialog with the logo and the copyright information of GtkBalls. You may use the keyboard shortcut CTRL-A to open it also. For more details on the license, click on the Show license button. This will open another dialog box where you can read the GNU General Public License. SEE ALSO
The GtkBalls web site at: http://gtkballs.antex.ru AUTHORS
GtkBalls was created by Eugene Morozov <jmv@online.ru>. This manual page was created by Christoph Thompson <obituary@freshmeat.net>. Cur- rent maintainer of GtkBalls and this manual page is drF_ckoff <dfo@antex.ru>. COPYRIGHT
GtkBalls is copyright 1998, 1999 Eugene V. Morozov under the terms of the GNU General Public License. GtkBalls is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the license, or (at your option) any later version. Version 3.1.5 A simple logic game GTKBALLS(6x)
All times are GMT -4. The time now is 09:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy