Sponsored Content
Top Forums Shell Programming and Scripting Search a string and append text after the string Post 302215661 by kesu2k on Thursday 17th of July 2008 12:39:27 AM
Old 07-17-2008
awesome..Thanks Annihilannic..It helped ..thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

appending string to text file based on search string

Hi, I need to append string "Hi" to the beginning of the lines containing some specific string. How can I achieve that? Please help. Malay (1 Reply)
Discussion started by: malaymaru
1 Replies

2. Shell Programming and Scripting

Trying to search for a string and append text only once

Hi I am trying to search for a particular occurrence of a string in a file, and if found, append another string to the end of that line. Here is my file contents: column1 userlist default nowrite=3 output=4 column2 access default nowrite=3 Here is the code: A="user=1... (1 Reply)
Discussion started by: bludhemn
1 Replies

3. Shell Programming and Scripting

Search for a string, then append character to end of that line only

I have 2 files that I am working with $ cat file1 server1 server3 server5 server6 server8 $ cat file2 server1;Solaris; server2; SLES; server3;Linux; server4; Solaris; server5;SLES; server6;SLES; server7;Solaris; server8;Linux; (1 Reply)
Discussion started by: snoman1
1 Replies

4. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

5. Shell Programming and Scripting

sed - Find a String and append a text end of the Line

Hi, I have a File, which have multiple rows. Like below 123456 Test1 FNAME JRW#$% PB MO Approver XXXXXX. YYYY 123457 Test2 FNAME JRW#$% PB MO Super XXXXXX. YYYY 123458 Test3 FNAME JRW#$% PB MO Approver XXXXXX. YYYY I want to search a line which contains PB MO Approver and append... (2 Replies)
Discussion started by: java2006
2 Replies

6. Shell Programming and Scripting

Search a string in a text file and add another string at the particular position of a line

I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB and add/replace... (1 Reply)
Discussion started by: suryanarayana
1 Replies

7. Shell Programming and Scripting

Search a string in a text file and add another string at the end of line

Dear All I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB... (5 Replies)
Discussion started by: suryanarayana
5 Replies

8. Shell Programming and Scripting

To Search for a string and to extract the string from the text

Hi Team I have an huge xml where i need to search for a ceratin numbers. For example 2014-05-06 15:15:41,498 INFO WebContainer : 10 CommonServicesLogs - CleansingTriggerService.invokeCleansingService Entered PUBSUB NOTIFY MESSAGE () - <?xml version="1.0" encoding="UTF-8"... (5 Replies)
Discussion started by: Kannannair
5 Replies

9. Shell Programming and Scripting

Need comand or script for append text after searching for the desired string

Hi all, i have a generated report in unix in the following command like input.txt 47.85,10 0124,42.35,8 0125,3.5,2 the input file format is fixed I need the my output file with append text as below output.txt 0124 amount:42.35 0125 amount:3.5 0124 count : 8 0125... (34 Replies)
Discussion started by: hemanthsaikumar
34 Replies

10. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies
Config::INI::Reader(3pm)				User Contributed Perl Documentation				  Config::INI::Reader(3pm)

NAME
Config::INI::Reader - a subclassable .ini-file parser VERSION
version 0.019 SYNOPSIS
If family.ini contains: admin = rjbs [rjbs] awesome = yes height = 5' 10" [mj] awesome = totally height = 23" Then when your program contains: my $hash = Config::INI::Reader->read_file('family.ini'); $hash will contain: { '_' => { admin => 'rjbs' }, rjbs => { awesome => 'yes', height => q{5' 10"}, }, mj => { awesome => 'totally', height => '23"', }, } DESCRIPTION
Config::INI::Reader is yet another config module implementing yet another slightly different take on the undeniably easy to read ".ini" file format. Its default behavior is quite similar to that of Config::Tiny, on which it is based. The chief difference is that Config::INI::Reader is designed to be subclassed to allow for side-effects and self-reconfiguration to occur during the course of reading its input. METHODS FOR READING CONFIG
These methods are all that most users will need: they read configuration from a source of input, then they return the data extracted from that input. There are three reader methods, "read_string", "read_file", and "read_handle". The first two are implemented in terms of the third. It iterates over lines in a file, calling methods on the reader when events occur. Those events are detailed below in the "METHODS FOR SUBCLASSING" section. All of the reader methods return an unblessed reference to a hash. All throw an exception when they encounter an error. read_file my $hash_ref = Config::INI::Reader->read_file($filename); Given a filename, this method returns a hashref of the contents of that file. read_string my $hash_ref = Config::INI::Reader->read_string($string); Given a string, this method returns a hashref of the contents of that string. read_handle my $hash_ref = Config::INI::Reader->read_handle($io_handle); Given an IO::Handle, this method returns a hashref of the contents of that handle. METHODS FOR SUBCLASSING
These are the methods you need to understand and possibly change when subclassing Config::INI::Reader to handle a different format of input. current_section my $section_name = $reader->current_section; This method returns the name of the current section. If no section has yet been set, it returns the result of calling the "starting_section" method. parse_section_header my $name = $reader->parse_section_header($line); Given a line of input, this method decides whether the line is a section-change declaration. If it is, it returns the name of the section to which to change. If the line is not a section-change, the method returns false. change_section $reader->change_section($section_name); This method is called whenever a section change occurs in the file. The default implementation is to change the current section into which data is being read and to initialize that section to an empty hashref. parse_value_assignment my ($name, $value) = $reader->parse_value_assignment($line); Given a line of input, this method decides whether the line is a property value assignment. If it is, it returns the name of the property and the value being assigned to it. If the line is not a property assignment, the method returns false. set_value $reader->set_value($name, $value); This method is called whenever an assignment occurs in the file. The default behavior is to change the value of the named property to the given value. starting_section my $section = Config::INI::Reader->starting_section; This method returns the name of the starting section. The default is: "_" can_ignore do_nothing if $reader->can_ignore($line) This method returns true if the given line of input is safe to ignore. The default implementation ignores lines that contain only whitespace or comments. preprocess_line $reader->preprocess_line($line); This method is called to preprocess each line after it's read but before it's parsed. The default implementation just strips inline comments. Alterations to the line are made in place. handle_unparsed_line $reader->handle_unparsed_line( $io, $line ); This method is called when the reader encounters a line that doesn't look like anything it recognizes. By default, it throws an exception. finalize $reader->finalize; This method is called when the reader has finished reading in every line of the file. new my $reader = Config::INI::Reader->new; This method returns a new reader. This generally does not need to be called by anything but the various "read_*" methods, which create a reader object only ephemerally. ORIGIN
Originaly derived from Config::Tiny, by Adam Kennedy. AUTHOR
Ricardo Signes <rjbs@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2007 by Ricardo Signes. 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 2011-12-15 Config::INI::Reader(3pm)
All times are GMT -4. The time now is 09:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy