Sponsored Content
Top Forums Shell Programming and Scripting Data and return code extraction Post 302474725 by freyr on Thursday 25th of November 2010 07:17:26 AM
Old 11-25-2010
Data and return code extraction

Hello everybody,

Another day another problem.

I have to create a script which collects data from 3 csv files.

I would like the script to check file1 which contains different values for the date entered previously. As you can see 01/12/2010 contains actions in the first field and in the second field a sub action (XXXZZ24), this sub action is the common element of the three csv files:

Code:
01/12/2010;;;
Action_1;"XXXZZ24";Comment1;"Comment2"
Action_2;"XXXZZ25";Comment1;"Comment2"
Action_3;"XXXZZ26";Comment1;"Comment2"
Action_4;"XXXZZ27";Comment1;"Comment2"
Action_5;"XXXZZ28";Comment1;"Comment2"
Action_6;"XXXZZ29";Comment1;"Comment2"
Action_7;"XXXZZ30";Comment1;"Comment2"
02/12/2010;;;
Action_8;"XXXZZ31";Comment1;"Comment2"
Action_9;"XXXZZ32";Comment1;"Comment2"
Action_0;"XXXZZ33";Comment1;"Comment2"
Action_1;"XXXZZ24";Comment1;"Comment2"
Action_5;"XXXZZ35";Comment1;"Comment2"
Action_6;"XXXZZ36";Comment1;"Comment2"
Action_2;"XXXZZ25";Comment1;"Comment2"

The second file contains actions and sub actions (for instance Action_1 is related to sub action XXXZZ24 and XXXZZ44) :

Code:
Action_1; XXXZZ24
Action_1; XXXZZ44
Action_2; XXXZZ25
Action_6; XXXZZ29
Action_3; XXXZZ26
Action_7; XXXZZ30

Finally, the third file contains actions and sub actions as well as hours of execution and return codes (return code is in the 7th field) :

Code:
"2010/12/02 12:31:54 	End of job";;;;;;;;;
LANCEUR;XXX7724;02/12/2010;12:31:22;02/12/2010;12:32:01;0;;Comment;Traces

Would anyone know how to make a script which :

- asks for a date
- then shows actions and sub actions from file1 for a specific date
- then matches actions and sub actions from the first file with the second file (assuming one action can have multiple sub actions)
- and finally matches the result of the 2 first files with the execution of the actions and sub actions which occured for a specific date in the third one.

The result of all this would be :

Code:
02/12/2010 :

"sub action" from "Action_1" executed succesfully (or not (depending on the return code (0 is OK, 1 is abnormal, and 3 is KO)) started at "hh:mm:ss" and ended at "hh:mm:ss"

I know it is a little bit tricky and I may not have made myself really clear but any help would be greatly appreciated.

Thanks Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Data Extraction issue.

I have a small problem, I have written a following script, which extracts all the rows from source file which strats with T101 and rights it to another file mydata.dat Script my_script #!/bin/ksh YMONTH=$1 dir1='/home/data' dir2='/clients/source_file' cd $dir1 grep "T101"... (5 Replies)
Discussion started by: irehman
5 Replies

2. Shell Programming and Scripting

help with data extraction script

Hello all, Iam newbie here and to unix programming. I have the following text file. A:Woshington,B:London,C:Paris,D:Manchester,C:Lisbon,E:Cape town. Now I would like extract this and store in database. here is the script I have tried but it did work. CITY1:`echo "$text" | grep "A:"... (11 Replies)
Discussion started by: mam
11 Replies

3. UNIX for Dummies Questions & Answers

to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's

Hi All, Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'. I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies

4. Shell Programming and Scripting

Data Extraction From a File

Hi All, I have a requirement where I have to search the file with some text say "Exception". This exception word can be repeated for more then 10 times. Suppose the "Exception" word is repeated at line numbers say x=10, 50, 60, 120. Now I want to extract all the lines starting from x-5 to... (3 Replies)
Discussion started by: rrangaraju
3 Replies

5. Shell Programming and Scripting

Another data extraction question

Hi, I have a tmp file like below: <ADATA> ANUM=900 ADESC=Saving ATYP=0 TXREGD=0 </ADATA> <ADATA> ANUM=890 ADESC=Saving ATYP=0 ABAL=9000 TXREGD=1 </ADATA> <ADATA> (6 Replies)
Discussion started by: kunigirib
6 Replies

6. Shell Programming and Scripting

Data extraction in perl variable

HI, i have variable in perl like below $tmp="/home/sai/automation/work/TFP_GN.txt" it can conatain any path its filled from config file. now i want extarct the path upto this /home/sai/automation/work/ and put it in another variable say... (4 Replies)
Discussion started by: raghavendra.nsn
4 Replies

7. Shell Programming and Scripting

Data Extraction problem in perl

Hello, I want to extract the words from a file which starts with SRD-R or SRD-DR. I have written a script which is able to trace the word but it is printing the whole line. sub extract_SRD_tag{ my ($tag, $app, $path, @data, $word ); $path = shift; $app = shift; open (FILE, $path) or... (2 Replies)
Discussion started by: suvendu4urs
2 Replies

8. Shell Programming and Scripting

data extraction from a file

Hi Freinds, I have a file1.txt in the following format File1.txt I want to get 2 files from the above file filextra.txt should have the lines which are ending with "<" and remaining lines in the filecompare.txt file. Please help. (3 Replies)
Discussion started by: i150371485
3 Replies

9. UNIX for Dummies Questions & Answers

Need help for data extraction if files

Hello all, I want to extract some particular data from a files and than add all the values . but i m not able to cut the particular word(USU-INOCT and USU-OUTOCT) as it is coming not in column. and than able to add values coming in it . can anyone help me Please cat <file name> ... (7 Replies)
Discussion started by: anamdev
7 Replies

10. Shell Programming and Scripting

CSV file data extraction

Hi I am writing a shell script to parse a CSV file , in which i am facing a problem to separate the columns . Could some one help me with it. IN301330/00001 pvavan kumar limited xyz@ttccpp.com IN302148/00002 PRECIOUS SECURITIES (P) LTD viash@yahoo.co.in IN300239/00000 CENTRE india... (8 Replies)
Discussion started by: nanduri
8 Replies
PKACTION(1)							     pkaction							       PKACTION(1)

NAME
pkaction - Get details about a registered action SYNOPSIS
pkaction [--version] [--help] pkaction [--verbose] pkaction --action-id action [--verbose] DESCRIPTION
pkaction is used to obtain information about registered polkit actions. If called without --action-id then all actions are displayed. Otherwise the action action. If called without the --verbose option only the name of the action is shown. Otherwise details about the actions are shown. RETURN VALUE
On success pkaction returns 0. Otherwise a non-zero value is returned and a diagnostic message is printed on standard error. AUTHOR
Written by David Zeuthen <davidz@redhat.com> with a lot of help from many others. BUGS
Please send bug reports to either the distribution or the polkit-devel mailing list, see the link http://lists.freedesktop.org/mailman/listinfo/polkit-devel on how to subscribe. SEE ALSO
polkit(8), polkitd(8), pkcheck(1), pkexec(1), pkttyagent(1) polkit May 2009 PKACTION(1)
All times are GMT -4. The time now is 09:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy