Sponsored Content
Top Forums Shell Programming and Scripting Have a situation while extracting info Post 302919266 by deepakiniimt on Tuesday 30th of September 2014 09:56:22 AM
Old 09-30-2014
my earlier logic in IF loop was missing some info which is coming now using your new command but still few info is missing , let me tell you that:
logic which i am using [file.lst is having all the extracted data from DB tables]

Code:
for i in `cat file.lst|awk '{print $1}'|sort|uniq`
do
   if [[ `cat file.lst |grep $i |awk '{print $2}'|grep UNDONE |wc -l` -gt "0" ]]
                then
                cat file.lst |grep $i |awk 'a!=$2{print;a=$2}'
                else
                cat file.lst |grep $i |awk '!a[$2,$4,5]++'
                fi

 done >> file.tmp

using this code , i was not getting below type of info, which i am getting now using your latest command:
earlier
Code:
 100050910 DONE        MRC                              taumrc1@taumrct1          08-SEP-14 09:42:16
 100050910 UNDONE      MRC                              taumrc1@taumrct1          09-SEP-14 18:05:26

now [which is correct because 4th column, ENV is having different env names]
Code:
 100050910 DONE        MRC                              taumrc1@taumrct1          08-SEP-14 09:42:16
 100050910 DONE        MRC                              taumrc2@taumrct1          08-SEP-14 09:44:06
 100050910 DONE        MRC                              taumrc3@taumrct1          08-SEP-14 09:46:15
 100050910 UNDONE      MRC                              taumrc1@taumrct1          09-SEP-14 18:05:26

But one info was missed from new logic :
earlier [which is correct]
Code:
 100051336 DEPLOYED        SMO                              occbap1@hppabc1          19-SEP-14 12:35:31
 100051336 UNDEPLOYED      SMO                              occbap1@hppabc1          19-SEP-14 12:40:01
 100051336 DEPLOYED        SMO                              occbap1@hppabc1          19-SEP-14 12:42:24
 100051336 UNDEPLOYED      SMO                              occbap1@hppabc1          19-SEP-14 12:46:15
 100051336 DEPLOYED        SMO                              occbap1@hppabc1          19-SEP-14 12:50:32
 100051336 UNDEPLOYED      SMO                              occbap1@hppabc1          19-SEP-14 12:55:53
 100051336 DEPLOYED        SMO                              occbap1@hppabc1          19-SEP-14 12:58:32
 100051336 UNDEPLOYED      SMO                              occbap1@hppabc1          19-SEP-14 13:13:15

now
Code:
 100051336 DEPLOYED        SMO                              occbap1@hppabc1          19-SEP-14 12:35:31
 100051336 UNDEPLOYED      SMO                              occbap1@hppabc1          19-SEP-14 12:40:01

Moderator's Comments:
Mod Comment Please use CODE tags (not ICODE tags) for multi-line code segments; and use CODE tags for sample input and output, not just for code segments.


---------- Post updated at 09:56 PM ---------- Previous update was at 01:32 PM ----------

any one ?

Last edited by Don Cragun; 09-30-2014 at 02:53 AM.. Reason: Fix ICODE tags; add CODE tags.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

extracting info from Unix database to construct a visual diagram

Ok heres the situation, We use Solaris 8 at work with Sybase for the db. I need to be able to easily create visual diagrams of some of our more complex systems. I've been using Visio which is such a manual process and takes a while. I was thinking maybe using Visio somehow in conjunction... (0 Replies)
Discussion started by: fusion99
0 Replies

2. UNIX for Dummies Questions & Answers

Extracting Info

i have a file that contain lines like this 9.4.7.8.5.7.9.0.5.7.1.2.msisdn.sub.cs. 1 IN CNAME SDP01.cs. there are about 50,000 lines like this in the files i want to the extract the digits from the above line like:- 947857905712 OS Solaris9 (3 Replies)
Discussion started by: muneebr
3 Replies

3. UNIX for Dummies Questions & Answers

Extracting specific info from finger command

Hello all, my unix is bash based and the finger command output is: Login Name Tty Idle LoginTime Office amos.john Amos John pts/26 1 Dec 5 16:18 (77.100.22.07) What am trying to achieve is extract the Login (amos.john) and Name (Amos John) from this output without using awk or sed. ... (1 Reply)
Discussion started by: franny
1 Replies

4. UNIX for Dummies Questions & Answers

Extracting spec info from finger.

Hi everyone, I'm trying to extract the user name and full name from the finger command without using sed or awk. Any pointers? Thanks in advance. (6 Replies)
Discussion started by: franny
6 Replies

5. UNIX for Dummies Questions & Answers

help : crisis situation !!

Hi I had deleted important files from my company server :( the server is HPUX and i don't know how to undo rm command or how to restore the files .. iam appreciate for any help Thanx ... (5 Replies)
Discussion started by: Eisa
5 Replies

6. Programming

problems iterating in RUBY while extracting info from YAML, Pls help!

Hi all, I am stuck with a ruby script that extracts detials from yaml file and processes accordingly. the yaml file confivnic: device: vnic1: policy: - L2 mode: active vnic2: policy: - L3 - L4 mode: active type: aggr ... (1 Reply)
Discussion started by: wrapster
1 Replies

7. UNIX for Dummies Questions & Answers

Extracting 482/300k columns no's with respective info. listed in file2 from file1

Hi, I have 2 files File 1: 1 2 3 4 5 6 .......etc until column 300K 1 23 21 24 12 22 1 23 21 24 12 22 1 23 21 24 12 22 1 23 21 24 12 22 1 23 21 24 12 22 1 23 21 24 12 22 1 23 21 24 12 22 . . etc until row 1411 File 2: (14 Replies)
Discussion started by: sogi
14 Replies

8. Shell Programming and Scripting

matching and extracting info from text files

Hi all, I have two .txt file i.e. First text file: 2 4 1 4 Second text file 2 1.nii.gz 4 334.nii.gz 1 12.nii.gz 4 134.nii.gz If entry in 1st column of 1st text file matches the 1st column of 2nd text file, then copy the file (name of which is the second column) associated with... (4 Replies)
Discussion started by: vd24
4 Replies

9. Solaris

Extracting HBA Card Hardware info

Hello, I am very new to solaris so please bear with me. I have 2 machines in question. For both I am trying to get the HBA Card Hardware information such as: HBA Model Name HBA Firmware version HBA Port details HBA Driver details First machine is a Solaris 10. When I execute fcinfo... (6 Replies)
Discussion started by: flagman5
6 Replies

10. UNIX for Dummies Questions & Answers

Extracting specific info finger command

how to extract user machine name for current terminal using finger command below command gives machinename for all session , is it possible to filter it to only currernt terminal ? finger -b -p $LOGNAME | grep from (12 Replies)
Discussion started by: lalitpct
12 Replies
All times are GMT -4. The time now is 03:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy