Sponsored Content
Full Discussion: Simple awk script needed
Top Forums Shell Programming and Scripting Simple awk script needed Post 302749741 by garethsays on Saturday 29th of December 2012 08:22:50 AM
Old 12-29-2012
Simple awk script needed

but I'm stumped...please help

I have a file like this.......

Code:
1000   1    34
1000   10   34
1000   11   35
1000   20   35
1000   21   36
1000   30   36
2000    1    34
2000    10   34

which I would like printed out as 40 lines

Code:
1000  1   34
1000  2   34
1000  3   34
1000  4   34
1000  5   34
1000  6   34
1000  7   34
1000  8   34
1000  9   34
1000  10   34
1000  11   35
1000  12   35
1000  13   35
1000  14   35
1000  15   35
1000  16   35
1000  17   35
1000  18   35
1000  19   35
1000  20   35
1000  21   36
1000  22   36
1000  23   36
1000  24   36
1000  25   36
1000  26   36
1000  27   36
1000  28   36
1000  29   36
1000  30   36
2000  1   34
2000  2   34
2000  3   34
2000  4   34
2000  5   34
2000  6   34
2000  7   34
2000  8   34
2000  9   34
2000  10   34

---------- Post updated at 01:22 PM ---------- Previous update was at 01:15 PM ----------

Actually the input file is

Code:
1000 1 
1000 10 
1000 11 
1000 20
1000 21
1000 30 
2000 1 
2000 10

I would like to set $3 based on when the range was read, i.e. between $2 on line 1 and $2 on line2, $3 should be 34, between $2 on line 3 and $2 on line 4, $3 should be 35 etc

Last edited by jim mcnamara; 12-29-2012 at 10:30 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simple awk script question

Hi, I'm a total beginner at awk and hope someone can advise what I have done wrong in the following script: I have a file which (to simplify things) may be something like this Fred Smith and Sue Brown Joe Jones and Jane Watts Sally Green and Jim O? Connor Freda O? Reiley and Pat O?... (2 Replies)
Discussion started by: Bab00shka
2 Replies

2. Shell Programming and Scripting

simple awk script...

hi everyone, i have a script that I use regulary to look through my files and directories it works fine, but I would like to add a segment to the script to make the output more readable and userfriendly.. (i am not an expert on scripts so there is no comments or status exits as of yet.. )... (3 Replies)
Discussion started by: moxxx68
3 Replies

3. Shell Programming and Scripting

simple script help needed

I am relatively new to *nix and have set up a small home network with a red hat server, what i would like to do is write a small script to check to see if a computer is connected by using the ip address of the computer. can get the ping to return but cant get the echo line working. the output i... (3 Replies)
Discussion started by: nobius
3 Replies

4. Shell Programming and Scripting

need help with simple awk/ksh script

I need help finding out why this script wont run. The chmod is okay, but i get an error saying that I need '&&' on line 5. (18 Replies)
Discussion started by: tefflox
18 Replies

5. Shell Programming and Scripting

Help with a simple script using awk

I need a hand with this simple script, in Unix i have a variable called portal: $ echo $portal chu0 when i use awk this variable is not recognized. How can i make awk recognize and print the value of this variable, since the output is not shown i.e. awk ' BEGIN {printf("%4s\t%14s\n",... (3 Replies)
Discussion started by: alexcol
3 Replies

6. Shell Programming and Scripting

script help needed --- awk?

hello and thanks in advance. I need to consolidate 2 records of data into 1 record. here is a sample of the input: ------------------------------------------------------------------------------------------ totalcount fred thomas 99999.00 88888:00 total 77777.00... (7 Replies)
Discussion started by: scuderiaf1
7 Replies

7. Shell Programming and Scripting

Simple AWK script problem.

Hi all, I have set up a simple awk script to calculate the average of values that are printed out a number of times per second (the number of time the printing occurs varies). The data is of the format shown below: 1 4.43 1 3.65 1 2.45 2 7.65 2 8.23 2 5.65 3 4.65 3 6.21 .. .. 120... (4 Replies)
Discussion started by: omnomtac
4 Replies

8. Shell Programming and Scripting

Simple Script needed for Processing CSV file perl

I am new to perl, and need a script to pull a CSV file, strip out 2 leading columns, and 2 ending columns, and resave the file in a new location. The file is basic and has less than 10,000 records. Secondly, can I schedule perl scripts to run daily? Can someone provide the basic script to... (1 Reply)
Discussion started by: cobbjob
1 Replies

9. Shell Programming and Scripting

help with simple awk script

Hi, I just don't understand awk. I think I'm close here but can someone give me a hand to finish this little parsing routine ? the input file is formatted like this: District 2502110 Gsub 2384889 Gsub 1428180 District 2502220 Gsub 1466390 Gsub 1466389 Gsub 1466388 Gsub 1466386 Gsub... (4 Replies)
Discussion started by: fwellers
4 Replies

10. Shell Programming and Scripting

Urgent simple script needed

Good Day All, I need your urgent support to get the following script (bash), (it should be as simple as possible please) : The script will check the .csv file( attached example) The script will generated 3 files from the initial one. The script must check one field “NEType”, and then ... (2 Replies)
Discussion started by: engkemo2002
2 Replies
XvGetPortAttribute(3)						  libXv Functions					     XvGetPortAttribute(3)

NAME
XvGetPortAttribute - return current port attribute value SYNOPSIS
#include <X11/extensions/Xvlib.h> int XvGetPortAttribute(Display *dpy, XvPortID port, Atom attribute, int p_value); ARGUMENTS
dpy Specifies the connection to the X server. port Specifies the port, associated with the given display, for which the attribute values are to be returned. attribute An atom that identifies the attribute to be queried by this request. Control atoms are obtained using the XInternAtom request with a string from the following table. p_value Pointer to the location where the attribute value is written on return. DESCRIPTION
XvGetPortAttribute(3) returns the current value of the requested port attribute in the integer pointed to by p_value. The attribute is identified using an Atom that equates to the attribute name. The XInternAtom request can be used with one of the strings below to return a matching Atom. ----------------------------------------------------- Attribute String Type Default ----------------------------------------------------- "XV_ENCODING" XvEncodingID Server dependent "XV_HUE" [-1000...1000] 0 "XV_SATURATION" [-1000...1000] 0 "XV_BRIGHTNESS" [-1000...1000] 0 "XV_CONTRAST" [-1000...1000] 0 RETURN VALUES
[Success] Returned if XvGetPortAttribute(3) completed successfully. [XvBadExtension] Returned if the Xv extension is unavailable. [XvBadAlloc] Returned if XvGetPortAttribute(3) failed to allocate memory to process the request. DIAGNOSTICS
[XvBadPort] Generated if the requested port does not exist. [BadMatch] Generated if the requested attribute atom does not specify an attribute supported by the adaptor. SEE ALSO
XvSetPortAttribute(3), XvPortNotify(3) X Version 11 libXv 1.0.7 XvGetPortAttribute(3)
All times are GMT -4. The time now is 03:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy