Sponsored Content
Top Forums UNIX for Advanced & Expert Users Need help on getting value from a file Post 302244871 by ukatru on Wednesday 8th of October 2008 10:56:00 PM
Old 10-08-2008
Need help on getting value from a file

I have a file which contains the data like below.It conatins more data than i posted here.

BEGIN DSJOB
Identifier "TestPart"
DateModified "2008-10-08"
TimeModified "00.36.32"
Identifier "ROOT"
DateModified "1899-12-30"
TimeModified "00.00.01"
OLEType "CJobDefn"
Readonly "0"
Name "Test"
NextID "1"
Container "V0"
JobVersion "50.0.0"
ControlAfterSubr "0"
MetaBag "CMetaProperty"
BEGIN DSSUBRECORD
BEGIN DSJOB
Identifier "GetFile"
DateModified "2008-10-05"
Identifier "ROOT"
DateModified "1899-12-30"
TimeModified "00.00.01"
OLEType "CJobDefn"
Readonly "0"
Name "Test"
NextID "1"
Container "V0"
JobVersion "50.0.0"
ControlAfterSubr "0"
MetaBag "CMetaProperty"
BEGIN DSSUBRECORD
BEGIN DSJOB
Identifier "TrimFields"
DateModified "2008-10-05"
Identifier "ROOT"
DateModified "1899-12-30"
TimeModified "00.00.01"
OLEType "CJobDefn"
Readonly "0"
Name "Test"
NextID "1"
Container "V0"
JobVersion "50.0.0"
ControlAfterSubr "0"
MetaBag "CMetaProperty"
BEGIN DSSUBRECORD
BEGIN DSJOB
Identifier "ConvertDate"
DateModified "2008-10-05"
Identifier "ROOT"
DateModified "1899-12-30"
TimeModified "00.00.01"
OLEType "CJobDefn"
Readonly "0"
Name "Test"
NextID "1"
Container "V0"
JobVersion "50.0.0"
ControlAfterSubr "0"
MetaBag "CMetaProperty"
BEGIN DSSUBRECORD
BEGIN DSJOB
Identifier "LoadTable"
DateModified "2008-10-05"
Identifier "ROOT"
DateModified "1899-12-30"
TimeModified "00.00.01"
OLEType "CJobDefn"
Readonly "0"
Name "Test"
NextID "1"
Container "V0"
JobVersion "50.0.0"
ControlAfterSubr "0"
MetaBag "CMetaProperty"
BEGIN DSSUBRECORD
BEGIN DSJOB
Identifier "Test"
DateModified "2008-10-05"



In the above text I need to grep for "BEGIN DSJOB" and when ever i find this text i need the line after this text.

Out put :

Identifier "TestPart"
Identifier "GetFile"
Identifier "TrimFields"
Identifier "ConvertDate"
Identifier "LoadTable"
Identifier "Test"

Please give me some suggestion how can i acheive this.

Thanks
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

2. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

3. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies
Test::use::ok(3pm)					User Contributed Perl Documentation					Test::use::ok(3pm)

NAME
Test::use::ok - Alternative to Test::More::use_ok SYNOPSIS
use ok( 'Some::Module' ); DESCRIPTION
According to the Test::More documentation, it is recommended to run "use_ok()" inside a "BEGIN" block, so functions are exported at com- pile-time and prototypes are properly honored. That is, instead of writing this: use_ok( 'Some::Module' ); use_ok( 'Other::Module' ); One should write this: BEGIN { use_ok( 'Some::Module' ); } BEGIN { use_ok( 'Other::Module' ); } However, people often either forget to add "BEGIN", or mistakenly group "use_ok" with other tests in a single "BEGIN" block, which can cre- ate subtle differences in execution order. With this module, simply change all "use_ok" in test scripts to "use ok", and they will be executed at "BEGIN" time. The explicit space after "use" makes it clear that this is a single compile-time action. SEE ALSO
Test::More COPYRIGHT
Copyright 2005, 2006 by Audrey Tang <cpan@audreyt.org>. This software is released under the MIT license cited below. The "MIT" License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MER- CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. perl v5.8.8 2008-02-29 Test::use::ok(3pm)
All times are GMT -4. The time now is 02:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy