Sponsored Content
Top Forums Shell Programming and Scripting Changing file content in perl Post 302892288 by Syed Imran on Wednesday 12th of March 2014 01:30:51 AM
Old 03-12-2014
Wrench

Thanks for the help,

but i have a file content like this,

Code:
#==============================================================

#<clear_category_list>

#<include file="SUITE:Security-Security.inc">

#<include file="CAT:SYSTEM:U75_U23.inc">
#<include file="CAT:PRIORITY:1.inc">
#<include file="CAT:FAC_TYPE:DEFAULT.inc">
#<include file="CAT:CARD_TYPE:MPMA-SHP3.inc">
#<include file="CAT:BOARD_TYPE:cpp8548.inc">
#<include file="CAT:SCHEDULER:3.inc">

#-------------------------------------------------------------- 

#<testcase_begin testcase_id="U75_U23_User_Security_Test">
 testcase_title="U75_U23 User Security Test">

#<testcase_requirements requirement_id="REGRESSION_REQ_ID">
#<testcase_script script="run_regression_usersec  -findboard ${BOARD_TYPE} -next -stop -var SYSTEM ${CATEGORY_SYSTEM} -schedule +${SCHEDULER}h ">

#<testcase_objectives_begin>
test the FEATUREGROUP feature for FEATURE for CARDTYPE
#<testcase_objectives_end>

#<testcase_setup_begin>
#<testcase_setup_end>

#<testcase_procedure_begin>
#<testcase_procedure_end>

#<testcase_expected_results_begin>
#<testcase_expected_results_end>

#<testcase_end>


#==============================================================

#<clear_category_list>

#<include file="SUITE:SAS_HK_MR537_Reg.inc">

#<include file="CAT:SYSTEM:SAS_U23.inc">
#<include file="CAT:PRIORITY:1.inc">
#<include file="CAT:FAC_TYPE:DEFAULT.inc">
#<include file="CAT:CARD_TYPE:DEFAULT.inc">
#<include file="CAT:BOARD_TYPE:cpp8548.inc">
#<include file="CAT:SCHEDULER:1.inc">

#-------------------------------------------------------------- 

#<testcase_begin testcase_id="SAS_U23_HK_MR537_Regression_Test">
 testcase_title="SAS_U23 HK MR537 Regression">

#<testcase_requirements requirement_id="REGRESSION_REQ_ID">
#<testcase_script script="run_regression_hk_r71  -findboard ${BOARD_TYPE} -next  -stop -var SYSTEM ${CATEGORY_SYSTEM} -schedule +${SCHEDULER}h ">

#<testcase_objectives_begin>
test the FEATUREGROUP feature for FEATURE for FACTYPE
#<testcase_objectives_end>

#<testcase_setup_begin>
#<testcase_setup_end>

#<testcase_procedure_begin>
#<testcase_procedure_end>

#<testcase_expected_results_begin>
#<testcase_expected_results_end>

#<testcase_end>


wheer i should search for the testcase based on the various "testcase_begin testcase_id" present, and then move up to search the keyword PRIORITY:10 or any number and then change it as PRIORITY:3

And then find the count.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need help with changing bash to perl

Hi guys, I am converting a bash script to perl. I need lots of help and pointers on how to make the script work. Any help would be greatly appreciated. Here is what I have: #!/usr/bin/perl #Decrypt Files $dir = "/usr/bin/gpg; opendir(PGP_DIR, $dir) || die "can't opendir $dir: $!";... (3 Replies)
Discussion started by: freak
3 Replies

2. Shell Programming and Scripting

file content in an array PERL

Hello everybody, I'm new in this forum. I searched a long time for a solution for my problem but I didn't find the right thing. I have to read from a file (content is "abngjm" without any other signs) and have to write this content in an array. But every sign has to be called by its own... (5 Replies)
Discussion started by: e_prof
5 Replies

3. Shell Programming and Scripting

Perl search and replace file content.

I am not sure if this is doable. I am trying to open and print the content of the file by replacing all instances fo perl to PERL . This is my code but it is giving me the number count instead of the actual lines with changes. open (PERLHISTORY, 'sample.txt') or die "The file sample.txt could... (3 Replies)
Discussion started by: jxh461
3 Replies

4. UNIX for Dummies Questions & Answers

Changing file content based on file header

Hi, I have several text files each containing some data as shown below: File1.txt >DataHeader Data... Data... File2.txt >DataHeader Data... Data... etc. What I want is to change the 'DataHeader' based on the file name. So the output should look like: File1.txt >File1 ... (1 Reply)
Discussion started by: Fahmida
1 Replies

5. Shell Programming and Scripting

changing files content with sed or awk

Hi, Example File: (jumped, bumped, ) how to jumped, FROM tree; EXIT I have some hundreads of files like this with the different words and I want to remove the comma before the bracket and also I have to remove the comma before FROM word. I am trying to use this command : awk '... (5 Replies)
Discussion started by: rajshashi
5 Replies

6. Shell Programming and Scripting

Need Help!!! For changing the content of the line

I need to change the content of the line after I grep it. The line is : Date SNWD.I-1 (in) WTEQ.I-1 (in) PREC.I-1 (in) TOBS.I-1 (degC) TMAX.D-1 (degC) TMIN.D-1 (degC) TAVG.D-1 (degC) I want to change the second column (SNWD.I-1(in)) to SNWD.I-1(m), how could I do that? I use csh... (2 Replies)
Discussion started by: handsonzhao
2 Replies

7. Shell Programming and Scripting

perl extract content of file

I'm using Mail::Internet module, which will basically filter through email content and extract the body of the message my perl script to extract the body of the email #!/usr/bin/perl -w use Mail::Internet; @lines = <STDIN>; $mi_obj = new Mail::Internet(); ... (2 Replies)
Discussion started by: amlife
2 Replies

8. Shell Programming and Scripting

Sed: replace content from file with the content from file

Hi, I am having trouble while using 'sed' with reading files. Please help. I have 3 files. File A, file B and file C. I want to find content of file B in file A and replace it by content in file C. Thanks a lot!! Here is a sample of my question. e.g. (file A: a.txt; file B: b.txt; file... (3 Replies)
Discussion started by: dirkaulo
3 Replies

9. Shell Programming and Scripting

Perl SCript to read file content (if else statemenet)

Hi All, I wanted to write a perl script to read the content in a file,the file content is either 0 (zero) OR 1. The idea is like this. If (content =1), then it will proceed to perform some step. and then update the file content to 0(zero) else if (content =0), it will update the content to... (11 Replies)
Discussion started by: hploh
11 Replies

10. Shell Programming and Scripting

How to remove exisiting file content from a file and have to append new file content?

hi all, i had the below script x=`cat input.txt |wc -1` awk 'NR>1 && NR<'$x' ' input.txt > output.txt by using above script i am able to remove the head and tail part from the input file and able to append the output to the output.txt but if i run it for second time the output is... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies
Test::Moose(3pm)					User Contributed Perl Documentation					  Test::Moose(3pm)

NAME
Test::Moose - Test functions for Moose specific features VERSION
version 2.0603 SYNOPSIS
use Test::More plan => 1; use Test::Moose; meta_ok($class_or_obj, "... Foo has a ->meta"); does_ok($class_or_obj, $role, "... Foo does the Baz role"); has_attribute_ok($class_or_obj, $attr_name, "... Foo has the 'bar' attribute"); DESCRIPTION
This module provides some useful test functions for Moose based classes. It is an experimental first release, so comments and suggestions are very welcome. EXPORTED FUNCTIONS
meta_ok ($class_or_object) Tests if a class or object has a metaclass. does_ok ($class_or_object, $role, ?$message) Tests if a class or object does a certain role, similar to what "isa_ok" does for the "isa" method. has_attribute_ok($class_or_object, $attr_name, ?$message) Tests if a class or object has a certain attribute, similar to what "can_ok" does for the methods. with_immutable { CODE } @class_names Runs CODE (which should contain normal tests) twice, and make each class in @class_names immutable in between the two runs. TODO
Convert the Moose test suite to use this module. Here is a list of possible functions to write immutability predicates anon-class predicates discovering original method from modified method attribute metaclass predicates (attribute_isa?) SEE ALSO
Test::More BUGS
See "BUGS" in Moose for details on reporting bugs. AUTHOR
Moose is maintained by the Moose Cabal, along with the help of many contributors. See "CABAL" in Moose and "CONTRIBUTORS" in Moose for details. COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-28 Test::Moose(3pm)
All times are GMT -4. The time now is 04:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy