Sponsored Content
Top Forums Shell Programming and Scripting To group records in the file in UNIX Post 303024851 by ginrkf on Thursday 18th of October 2018 03:22:14 AM
Old 10-18-2018
Hi All, Now my requirement is change, but almost similar to the above one. But using the above code it is not working.I tried different option but its not giving correctly.

My input file is given below

Code:
#### RUNNING JOBS IN SITE#####

#### NOT RUNNING JOBS IN SITE#####

1> XXX Job is Running in the project WQW
2> SSS Job is Running in the project WQW
3> DDD Job is Running in the project WQW
4> EEE Job is Running in the project WQW
5> FFF Job is not running(Failed/Stopped/Reset/Not Compiled/Compiled) in the project WQW

My expected output file is given below

Code:
#### RUNNING JOBS IN SITE#####

1> XXX Job is Running in the project WQW
2> SSS Job is Running in the project WQW
3> DDD Job is Running in the project WQW
4> EEE Job is Running in the project WQW

#### NOT RUNNING JOBS IN SITE#####

1> FFF Job is not running(Failed/Stopped/Reset/Not Compiled/Compiled) in the project WQW

I tried this code as given below, but it didn't work

Code:
awk '
NR == 1         {print
                 next
                }
! NF            {next
                }
/is running/        {$1 = ++FCNT ">"
                 print
                 next
                }
                {$1 = ++CCNT ">"
                 C[CCNT] = $0
                }
END             {print ORS "#### NOT RUNNING JOBS CCM SITE#####" ORS
                 for (c=1; c<=CCNT; c++) print C[c]
                }
'

Appreciate your help here
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

find and group records in a file

Hi, I have this file which has 3 columns, District , stores and unit. What I want is all rows belonging to one district to be created separately under each district, the districts may vary every day , the source file may have 3 districts today and may have 160 tomorrow, so what I need is a... (20 Replies)
Discussion started by: thumsup9
20 Replies

2. Shell Programming and Scripting

Column sum group by uniq records

Dear All, I want to get help for below case. I have a file like this. saman 1 gihan 2 saman 4 ravi 1 ravi 2 so i want to get the result, saman 5 gihan 2 ravi 3 like this. Pls help me. (17 Replies)
Discussion started by: Nayanajith
17 Replies

3. Shell Programming and Scripting

command to group records

hi, i have records like this supplier,product, persons involved 10,150,ravi@yahoo.com 30,200,ravi@yahoo.com 20,111,payal@gmail.com 40,211,ravi@yahoo.com i want to write a command which displays values like this 10,30,40,ravi@yahoo.com for ravi@yahoo.com if there are n number of... (7 Replies)
Discussion started by: trichyselva
7 Replies

4. Shell Programming and Scripting

KSH to group records in a file and compare it with another file

Hi, I've a file like below: DeptFile.csv DeptID EmpID ------- ------ Dep01 Emp01 Dep01 Emp02 Dep01 Emp03 Dep02 Emp04 Dep02 Emp05 I've another file which has EmpFile.csv EmpID Salary ------ ------ (3 Replies)
Discussion started by: Matrix2682
3 Replies

5. Shell Programming and Scripting

how to group records in a file

hi, I have records like this D127@dm.com,127,569,BRAD,25/08/2009 23:59 D127@dm.com,127,569,BRAD,25/08/2009 23:59 D159@dm.com,159,1170,DAVE,25/08/2009 23:59 D159@dm.com,159,1181,HALE,25/08/2009 23:59 D393@dm.com,393,1209,CAPIT,25/08/2009 23:59 D457@dm.com,457,571,NORTT,25/08/2009 23:59... (4 Replies)
Discussion started by: trichyselva
4 Replies

6. Shell Programming and Scripting

grouping records in a file in unix

I have file like this d123, rahim, 140 d123, rahul, 440 d123, begum, 340 d234, bajaj, 755 d234, gajal, 657 I want to group this file like this d123, rahim, 140 rahul, 440 begum, 340 d234, bajaj, 755 gajal, 657 can any one help me on this thanks in advance (8 Replies)
Discussion started by: trichyselva
8 Replies

7. Infrastructure Monitoring

Processing records as group - awk

I have a file has following records policy glb id 1233 name Permit ping from "One" to "Second" "Address1" "Any" "ICMP-ANY" permit policy id 999251 service "snmp-udp" exit policy glb id 1234 name Permit telnet from "One" to "Second" "Address2" "Any" "TCP-ANY" permit policy id 1234... (3 Replies)
Discussion started by: baskar
3 Replies

8. Shell Programming and Scripting

Need unix commands to delete records from one file if the same record present in another file...

Need unix commands to delete records from one file if the same record present in another file... just like join ... if the record present in both files.. delete from first file or delete the particular record and write the unmatched records to new file.. tried with grep and while... (6 Replies)
Discussion started by: msathees
6 Replies

9. Shell Programming and Scripting

Sorting group of records and loading last record

Hi Everyone, I have below record set. File is fixed widht file 101newjersyus 20150110 101nboston us 20150103 102boston us 20140106 102boston us 20140103 I need to group record based on first 3 letters in our case(101 and 102) and sort last 8 digit in ascending order and print only... (4 Replies)
Discussion started by: patricjemmy6
4 Replies

10. UNIX for Beginners Questions & Answers

Awk: group multiple fields from different records

Hi, My input looks like that: A|123|qwer A|456|tyui A|456|wsxe B|789|dfgh Using awk, I am trying to get: A|123;456|qwer;tyui;wsxe B|789|dfgh For records with same $1, group all the $2 in a field (without replicates), and all the $3 in a field (without replicates). What I have tried:... (6 Replies)
Discussion started by: beca123456
6 Replies
globus_gram_job_manager_script_interface(3)		      globus gram job manager		       globus_gram_job_manager_script_interface(3)

NAME
globus_gram_job_manager_script_interface - Job Manager Scheduler Interface The GRAM Job Manager interfaces with the job filesystems and scheduler through scheduler-specific Perl modules. GRAM provides several Perl modules which can be used to implement scheduler-specific interfaces to the GRAM Job Manager. These are: Globus::GRAM::Error This module implements the GRAM error results as objects. Methods in this module will construct a GRAM error with the value matching the values in the GRAM Protocol library. A scheduler-specific JobManager module may return one of these objects from its methods to indicate errors to the Job Manager program. Globus::GRAM::JobState This module defines the GRAM job state constants. A scheduler-specific JobManager module returns one of these values from its methods to indicate the managed job's current state. Globus::GRAM::JobSignal This module defines the GRAM job signal constant values. The Job Manager uses these values to communicate which signal is being invoked in the manager's signal method. Globus::GRAM::JobManager This module defines the actual implementatoin of the Job Manager scheduler interface. One writing a scheduler-specific GRAM interface will create a subclass of this object which overrides the default implementation's methods. Globus::GRAM::JobDescription This module mimics the RSL job description using perl syntax. The job manager passes an object of this type to the JobManager modules's constructor. The job manager stores RSL and some configuration values in that JobDescription object. The manager accesses values stored in the JobDescription by invoking methods containing the RSL attribute's name (example: $description->gram_my_job()). Method names are handled as if they were based on the canonical RSL representation of the attribute name. For example, the gram_my_job may be equivalently referred to as GramMyJob, grammyjob, or GRAM_My_Job. Version 13.33 Mon Apr 30 2012 globus_gram_job_manager_script_interface(3)
All times are GMT -4. The time now is 01:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy