Sponsored Content
Top Forums Shell Programming and Scripting awk script to get words which are not in a particula order Post 302407933 by raghu.iv85 on Saturday 27th of March 2010 06:31:25 AM
Old 03-27-2010
awk script to get words which are not in a particula order

Hi all,

I need a big help. I've a requirment which should be done in awk scripting only..
My requirment is:

In below file, there are some lines started with 'master replica:'.
i want to get the exact word in that line which should be before '@', and i've to create a file with these names line by line. Either the input file may contain multiple replicas or it may has only original replica.. But any of these both cases, it must contain the original replica..
Ex o/p:
replica1
replica2
original
*******************Sample File Contents*******************
replica "<replica1>"
2006-10-10T06:02:36+10 by Clearcase Admin Acct - xxxxxxx; xxxxxxx [xxxxxxx] (xxxxxxx@main_server)
"Replica for stm VOB /vobs/<vob_name>"
replica type: unfiltered
master replica: <replica1>@/vobs/<vob_name>
owner: vobadmin
group: xxxxxxxxx
host: "<replica_server1>"
identities: preserved
permissions: preserved
feature level: unknown
connectivity: connected
replica "<replica2>"
2006-10-10T06:02:36+10 by Clearcase Admin Acct - xxxxxxx; xxxxxxx [xxxxxxx] (xxxxxxx@main_server)
"Replica for stm VOB /vobs/<vob_name>"
replica type: unfiltered
master replica: <replica2>@/vobs/<vob_name>
owner: vobadmin
group: xxxxxxxxx
host: "<replica_server2>"
identities: preserved
permissions: preserved
feature level: unknown
connectivity: connected
replica "original"
2005-11-02T22:51:59+11 by ************* (***-**-*-@/**/*/*/*/)
"<Original_replica>"
replica type: unfiltered
master replica: original@/vobs/<vob_name>
request for mastership: enabled
owner: laserdev
group: xxxxxxxxx
host: "<main_server_alias>"
identities: preserved
permissions: preserved
feature level: 4
connectivity: connected
***************************************************
So It means that, the script should create a file with all replica names like in above mentioned example and it has to return (as an o/p) the host parameter of original replica.
For example, there is a replica with "original" name (see below for example), so under that original replica, there is a line which start with "host:", I want to get that <main_server_alias> name as a o/p of the script.
*****************example one*************
replica "original"
2005-11-02T22:51:59+11 by ************* (***-**-*-@/**/*/*/*/)
"<Original_replica>"
replica type: unfiltered
master replica: original@/vobs/<vob_name>
request for mastership: enabled
owner: laserdev
group: xxxxxxxxx
host: "<main_server_alias>" ------> I want to get this <main_server_alias> name as a o/p of the script
identities: preserved
permissions: preserved
feature level: 4
connectivity: connected
*************************************

Can anyone please help on this? It'll very helpful for me..
Thank you to everyone for providing great steps for my queries..
Please let me know for any queries/doubts on this...

Thanks in advance..
Regards,
Raghu
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

List number in decending order using AWK

Hi All, Can anyone show me how to list the below numbers in decending order? I have a code to find out whats the largest number though but can it be modified to in-corporate in function ? Thanks in advance Input: 20 30 10 40 50 Output: 50 40 30 20 (2 Replies)
Discussion started by: Raynon
2 Replies

2. Shell Programming and Scripting

compare strings, words in different order

Hi, Would anyone know how to compare two strings, and only throw an error if there were different words, not that the same words were in a different order? e.g "A B C" vs "B C A" ->OK "A B C" vs "A D C" -> BAD Thanks! (2 Replies)
Discussion started by: rebelbuttmunch
2 Replies

3. Shell Programming and Scripting

sed or awk to order a file

Hi - I have a file with lots of lines in that I need to order based on the number of commas! e.g the file looks something like :- cn=john,cn=users,cn=uk,dc=dot,dc=com cn=john,cn=users,dc=com cn=users,cn=groups,dc=com cn=john,cn=admins,cn=users,cn=uk,dc=dot,dc=com... (4 Replies)
Discussion started by: sniper57
4 Replies

4. Shell Programming and Scripting

Keep lines with specific words up in an order

I hava a file with following data: number|CREDIT_ID|NULL date|SYS_CREATION_DATE|NULL varchar2|GGS_COMMIT_CHAR|NULL varchar2|GGS_OP_TYPE|NULL number|GGS_SCN|NULL| number|GGS_LOG_SEQ|NULL number|GGS_LOG_POS|NULL number|GGS_ORACREC_SCN|NULL varchar2|BATCH_ID|NULL char|GGS_IMAGE_TYPE|NULL ... (6 Replies)
Discussion started by: kolesunil
6 Replies

5. Shell Programming and Scripting

Shell script to find out words, replace them and count words

hello, i 'd like your help about a bash script which: 1. finds inside the html file (it is attached with my post) the code number of the Latest Stable Kernel, 2.finds the link which leads to the download location of the Latest Stable Kernel version, (the right link should lead to the file... (3 Replies)
Discussion started by: alex83
3 Replies

6. UNIX for Dummies Questions & Answers

Searching for multiple words on a line in any order issue

Hi again I have figured out how to be able to sort through lines in a file with multiple words in any order and display them using this command: cat file | grep -i $OPTION1 | grep -i $OPTION2 | grep -i $OPTION3 OPTION1 is 2008, OPTION2 is Mar, OPTION 3 is Tue Result: Tue Mar 25... (4 Replies)
Discussion started by: semaj
4 Replies

7. Shell Programming and Scripting

Putting values into order in a field using awk

Hi, I am using UBUNTU 12.04. I have a dataset as follows: Column#1 Column#2 Column#3 .... Column#50 1 154878 1 145145 2 189565 2 454121 ... (5 Replies)
Discussion started by: Homa
5 Replies

8. Shell Programming and Scripting

awk - Why does output order change?

I have this END section in an awk script: END { for (j in littlebin) { print (j, int(log(j)/log(2)) , littlebin) lbsum+=littlebin } for (i in bins) ... (6 Replies)
Discussion started by: treesloth
6 Replies

9. Shell Programming and Scripting

How order a data matrix using awk?

is it possible to order the following row clusters from ascending to descending. thanx in advance input 1 2 4 0 1 2 4 0 3 3 3 3 1 5 1 0 1 5 1 0 6 0 0 0 5 1 1 1... (4 Replies)
Discussion started by: quincyjones
4 Replies

10. Shell Programming and Scripting

Using awk add preffic to dynamic order

Source file portIndex: 75 portName: slot9 port11 c0:50:96:05:9f:f2:00:f2 c0:50:96:05:9f:f2:00:ea c0:50:96:05:9f:f2:01:13 c0:50:96:05:9f:f2:01:12 c0:50:96:05:9f:f2:01:0b c0:50:96:05:9f:f2:01:0a c0:50:96:05:9f:f2:01:03 ... (2 Replies)
Discussion started by: ranjancom2000
2 Replies
LFC_SETPTIME(3) 					       LFC Library Functions						   LFC_SETPTIME(3)

NAME
lfc_setptime - set replica pin time SYNOPSIS
#include <sys/types.h> #include "lfc_api.h" int lfc_setptime (const char *sfn, time_t ptime) DESCRIPTION
lfc_setptime sets the pin time for a file replica to a given time. This function should be called everytime a file replica is created, when its lifetime is extended or when the replica is released. sfn is the Physical File Name for the replica. ptime specifies the new lifetime. RETURN VALUE
This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, serrno is set appropriately. ERRORS
ENOENT The named replica does not exist. EACCES Search permission is denied on a component of the file prefix or the caller effective user ID does not match the owner ID of the file or read permission on the file itself is denied. EFAULT sfn is a NULL pointer. ENAMETOOLONG The length of sfn exceeds CA_MAXSFNLEN. SENOSHOST Host unknown. SENOSSERV Service unknown. SECOMERR Communication error. ENSNACT Name server is not running or is being shutdown. SEE ALSO
Castor_limits(4), lfc_listreplica(3) LFC
$Date: 2005/04/27 09:11:24 $ LFC_SETPTIME(3)
All times are GMT -4. The time now is 10:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy