Sponsored Content
Top Forums Shell Programming and Scripting Displaying text till pattern match found in a line Post 302764247 by Optimus81 on Thursday 31st of January 2013 07:31:30 AM
Old 01-31-2013
Displaying text till pattern match found in a line

Hi All,
From the below line if we want to display all the text till found pattern dot/. I was trying with the below code but couldn't able
to print text before the pattern. it display texts which is found after pattern.
Code:
awk '/[Pp]assed/{print;getline;print}' file_name | sed 's/^[^:]*. *//'

input line from the file_name looks like
Code:
U12-C02: Software checks is passed. (Latest Software version : IED-2011-S : upgrade_01 4.13.2 (4.10.15_TREP-RT_13.31))

Currently it is displaying like this :
Code:
Software checks is passed. (Latest Software version : IED-2011-S : upgrade_01 4.13.2 (4.10.15_TREP-RT_13.31))

expected output should be like this :
Code:
U12-C02: Software checks is passed.

Many Thanks,
Optimus
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk script to match pattern till blank line

Hi, I need to match lines after a pattern, upto the first blank line. Searched in web and some forums but coulnt find the answer. where <restart_step> = 10 -- Execute query 20 -- Write the contents to the Oracle table 30 -- Writing Contents to OUTPUT... (7 Replies)
Discussion started by: justchill
7 Replies

2. Shell Programming and Scripting

Print characters till the next space when the pattern is found

i have a file which contains alphanumeric data in every line. what i need is the data after certain pattern. the data after the pattern is not of fixed length so i need the data till the space after the pattern. Input file: bfdkasfbdfg khffkf lkdhfhdf pattern (datarequired data not required)... (2 Replies)
Discussion started by: gpk_newbie
2 Replies

3. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

Hi, I have got the below requirement. please suggest. I have a file like, Processing Item is: /data/ing/cfg2/abc.txt /data/ing/cfg3/bgc.txt Processing Item is: /data/cmd/for2/ght.txt /data/kernal/config.klgt.txt I want to process the above file to get the output file like, ... (5 Replies)
Discussion started by: rbalaj16
5 Replies

4. Shell Programming and Scripting

Pattern match till the end of the file.

I have a file which is like this ……………………………………….. ………………………………… ………………………………… …………………………………… ……………………………………. ……………………………… <<<from_here>>> ……………………………… ………………………………. I want a script which would fetch the data starting from <<<from_here>>> in the file till the end... (2 Replies)
Discussion started by: halfafringe
2 Replies

5. Shell Programming and Scripting

To add a new line with specific text after the pattern is found using sed

hi guys, im trying to add the following line in my xml file <dbrollbacksegs <oa_var="s_db_rollback_segs">NOROLLBACK</dbrollbacksegs> when ever i find the following line <dbsharedpool oa_var="s_dbsharedpool_size">300000000</dbsharedpool> I have succedded till adding a new line... (1 Reply)
Discussion started by: smarlaku
1 Replies

6. Shell Programming and Scripting

If first pattern is found, look for second pattern. If second pattern not found, delete line

I had a spot of trouble coming up with a title, hopefully you'll understand once you read my problem... :) I have the output of an ldapsearch that looks like this: dn: cn=sam,ou=company,o=com uidNumber: 7174 gidNumber: 49563 homeDirectory: /home/sam loginshell: /bin/bash uid: sam... (2 Replies)
Discussion started by: samgoober
2 Replies

7. UNIX for Dummies Questions & Answers

Shell Script for displaying the line till the target word

" Script for display sentences with special character" Hi, Could any one share a command how to display a line until my target word. For ex: My file has the content as: select * from db_wrk where col1 < col2 insert into table_name values('1','2','tst','wrk','dev','prod') My target... (10 Replies)
Discussion started by: Kalaiselvi66
10 Replies

8. Shell Programming and Scripting

Append text on particular line after pattern found

hi, i have /etc/inittab, I want to add another line after that when i find a pattern "l6:6:wait:/etc/rc.d/rc 6". original l6:6:wait:/etc/rc.d/rc 6 after-change l6:6:wait:/etc/rc.d/rc 6 /sbin/if-pp-to-cng (3 Replies)
Discussion started by: learnbash
3 Replies

9. Shell Programming and Scripting

Rearrange or replace only the second line after pattern match or pattern match

Im using the command below , but thats not the output that i want. it only prints the odd and even numbers. awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}' Im hoping for something like this file1: Text hi this is just a test text1 text2 text3 text4 text5 text6 Text hi... (2 Replies)
Discussion started by: invinzin21
2 Replies

10. UNIX for Beginners Questions & Answers

Modify text file if found multiple pattern match for every line.

Looking for help, i have input file like below and want to modify to expected output, if can without create additional file, hope can direct modify it. have 2 thing need do. 1st is adding a word (testplan generation off) after ! ! IPG: Tue Aug 07 14:31:17 2018 2nd is adding... (16 Replies)
Discussion started by: kttan
16 Replies
Software::License(3pm)					User Contributed Perl Documentation				    Software::License(3pm)

NAME
Software::License - packages that provide templated software licenses VERSION
version 0.103004 SYNOPSIS
my $license = Software::License::Discordian->new({ holder => 'Ricardo Signes', }); print $output_fh $license->fulltext; METHODS
new my $license = $subclass->new(\%arg); This method returns a new license object for the given license class. Valid arguments are: holder - the holder of the copyright; required year - the year of copyright; defaults to current year new_from_short_name my $license = Software::License -> new_from_short_name( { short_name => 'GPL-1', %arg } ); This constructor will return the correct subclass depending on "short_name" value. year holder These methods are attribute readers. name This method returns the name of the license, suitable for shoving in the middle of a sentence, generally with a leading capitalized "The." url This method returns the URL at which a canonical text of the license can be found, if one is available. If possible, this will point at plain text, but it may point to an HTML resource. notice This method returns a snippet of text, usually a few lines, indicating the copyright holder and year of copyright, as well as an indication of the license under which the software is distributed. license This method returns the full text of the license. fulltext This method returns the complete text of the license, preceded by the copyright notice. version This method returns the version of the license. If the license is not versioned, this method will return false. meta_name This method returns the string that should be used for this license in the CPAN META.yml file, according to the CPAN Meta spec v1, or undef if there is no known string to use. This method may also be invoked as "meta_yml_name" for legacy reasons. meta2_name This method returns the string that should be used for this license in the CPAN META.json or META.yml file, according to the CPAN Meta spec v2, or undef if there is no known string to use. If this method does not exist, and "meta_name" returns open_source, restricted, unrestricted, or unknown, that value will be used. summary This method returns a summary of the license. This summary must contains refer to a file containing the whole license. On Debian system, the file containing the whole license will be in "/usr/share/common-licenses/" directory. LOOKING UP LICENSE CLASSES
If you have an entry in a META.yml or META.json file, or similar metadata, and want to look up the Software::License class to use, there are useful tools in Software::LicenseUtils. TODO
o register licenses with aliases to allow $registry->get('gpl', 2); SEE ALSO
The specific license: o Software::License::AGPL_3 o Software::License::Apache_1_1 o Software::License::Apache_2_0 o Software::License::Artistic_1_0 o Software::License::Artistic_2_0 o Software::License::BSD o Software::License::CC0 o Software::License::FreeBSD o Software::License::GFDL_1_2 o Software::License::GPL_1 o Software::License::GPL_2 o Software::License::GPL_3 o Software::License::LGPL_2_1 o Software::License::LGPL_3_0 o Software::License::MIT o Software::License::Mozilla_1_0 o Software::License::Mozilla_1_1 o Software::License::None o Software::License::OpenSSL o Software::License::Perl_5 o Software::License::QPL_1_0 o Software::License::SSLeay o Software::License::Sun o Software::License::Zlib AUTHOR
Ricardo Signes <rjbs@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 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 2012-03-23 Software::License(3pm)
All times are GMT -4. The time now is 10:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy