make the name of file and fetch few things from log file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting make the name of file and fetch few things from log file
# 1  
Old 04-23-2012
make the name of file and fetch few things from log file

Hello All,
I am working on a script where I need to fetch the value from a log file and log file creates with different name but few thing are common
Code:
DEV_INFOMGT161_MULTI_PTC_BLD01.Stage_All_to_stp2perf1.042312114644.log

STP_12_02_01_00_RC01.Stage_stp-domain_to_stp2perf2.042312041739.log

STPPRODUCTS_01_01_PRE_BLD06.Stage_tag_to_stp2qa1.041912201909.log

First I need to make the name of file for example
${Source Tag}.Stage[Please help me to make the name of the file above]
and then I need to fetch the few things like from the below format

Code:
Build Complete. Values are:
    Today's Date:..............04/23/12
    Build Type:................Stage
    Build Context:.............intg
    Source Tag:................DEV_INFOMGT161_MULTI_PTC_BLD01
    Destination Tag:...........NotApplicable
    Destination Environment:...stp2perf1
    STP Application Name:......All
    Start Time:................11:46:44 GMT
    End Time:..................11:53:43 GMT
    Elapsed Time:..............00:06:59
    Soa Version:...............08_07_00
    Override Properties File:.."/projects/stp/home/stpbuild/override.files/DEV_INFOMGT161_MULTI_PTC"
    Java Version:..............jdk1.6.0_13
    Tomcat Version:............/opt/apache-tomcat-7.0.19
    Result:....................SUCCESSFUL
    Log File:
      DEV_INFOMGT161_MULTI_PTC_BLD01.Stage_All_to_stp2perf1.042312114644.log

These below three thing which I want to fetch from the above log file
Build Type
Source Tag
Result


Thanks
# 2  
Old 04-23-2012
Does this get you started?

Code:
$ cat sample3.txt
Build Complete. Values are:
    Today's Date:..............04/23/12
    Build Type:................Stage
    Build Context:.............intg
    Source Tag:................DEV_INFOMGT161_MULTI_PTC_BLD01
    Destination Tag:...........NotApplicable
    Destination Environment:...stp2perf1
    STP Application Name:......All
    Start Time:................11:46:44 GMT
    End Time:..................11:53:43 GMT
    Elapsed Time:..............00:06:59
    Soa Version:...............08_07_00
    Override Properties File:.."/projects/stp/home/stpbuild/override.files/DEV_INFOMGT161_MULTI_PTC"
    Java Version:..............jdk1.6.0_13
    Tomcat Version:............/opt/apache-tomcat-7.0.19
    Result:....................SUCCESSFUL
    Log File:
      DEV_INFOMGT161_MULTI_PTC_BLD01.Stage_All_to_stp2perf1.042312114644.log

$ grep "Build Type" <sample3.txt | awk -F"." '{print $NF}'
Stage

# 3  
Old 04-23-2012
I have on emore question here how could I make the format of below files like
Few thing I already know that is first parameter 1 parammeter.Stage(always hardcoded)...............Destination Environment(3rd parameter)

but how could I make it with something like wild card ie. between Stage and Destination Environment
Code:
 
DEV_INFOMGT161_MULTI_PTC_BLD01.Stage_All_to_stp2perf1.042312114644.log

STP_12_02_01_00_RC01.Stage_stp-domain_to_stp2perf2.042312041739.log

STPPRODUCTS_01_01_PRE_BLD06.Stage_tag_to_stp2qa1.041912201909.log

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Fetch data from file

Hi, I am new to scripting. I have a log file and need to fetch specific logs and copy to another file. A copy of the log is like this: =============================================================== = JOB : server123#jobs1.jobstream1 = USER : andyc = Tue 08/01/17... (3 Replies)
Discussion started by: Prngp
3 Replies

2. Shell Programming and Scripting

Trying to make a bash script that goes through directory files and changes things

I'm trying to write a script in a directory that goes through the column the user specifies of 4 files that are inside the directory and calculates the min and the max values. This means that if the user specifies column 5, the script will go through column 5 of all 4 files and all that should give... (2 Replies)
Discussion started by: Eric1
2 Replies

3. Shell Programming and Scripting

script to fetch from file

Hi Guys, I have a file with around 1000 strings and i need to fetch the group to which each string belongs to from another file. Example is seen below. File 1: A B D File 2: START A B C END START M (5 Replies)
Discussion started by: jayadanabalan
5 Replies

4. Shell Programming and Scripting

how to make my own file as a running log file in bash

Hi, I have written a small script from that iam appending the output to a file.If multiple users invoke the same script or if i invoke the same script n number of times (using &), the output file(ZZ/OUT) contains messup information. #!/bin/bash # echo "Hello" >> /tmp/ZZ/OUT sleep 10 echo... (4 Replies)
Discussion started by: blrguest
4 Replies

5. Programming

makeutility: how to get the make-file name inside of the make-file?

How I can get the current make-file name in a make-file So, if I run make with specified file:make -f target.mak is it possible to have the 'target' inside of the that 'target.mak' from the file name? (2 Replies)
Discussion started by: alex_5161
2 Replies

6. Shell Programming and Scripting

how to make a log file of extract time

Dear All, Please apology to me if this question already posted, because I try to find it but not found. I have make bash script to automatically download data from ftp and this running very well. and after the data downloaded it will automatically extract the data and keep in the specific... (2 Replies)
Discussion started by: chenboly
2 Replies

7. Shell Programming and Scripting

Adding things in a file and produce a new one

I wanna add a ":" at the end of each line, and i did something like this: cat Totals | while read ID TOTAL do echo "${ID}:${TOTAL}:" >>Totals2 done File: Totals 12345678:13 21443433:20 The outputs file Totals2 is: 12345678:13:: 21443433:20:: but i want 12345678:13:... (3 Replies)
Discussion started by: mingming88
3 Replies

8. Shell Programming and Scripting

Fetch lines from a file matching column2 of another file

Hi guys, Please help me out in this problem. I have two files FILE1 abc-23 : 4529675 cde-42 : 9824532 dge-91 : 1245367 gre-45 : 9824532 fgr-76 : 4529675 FILE2 4529675 : Gal Glu house-2-be 9824532 : cat mouse 1245367 : sirf surf-2-beta where FILE2 is a static file with fixed... (5 Replies)
Discussion started by: smriti_shridhar
5 Replies

9. Shell Programming and Scripting

Fetch the field from file and add to new file.

Admins Pls. assist me to update a new field having 40 rows to a file. Test1.output LV Space %free Space_used_04_15 dev 500 7 67% dev1 800 7 75% dev2 800 7 75% dev3 900 7 ... (2 Replies)
Discussion started by: maestrohero
2 Replies
Login or Register to Ask a Question