Sponsored Content
Top Forums Shell Programming and Scripting Print field after pattern in all lines Post 302988833 by RavinderSingh13 on Tuesday 3rd of January 2017 12:17:33 PM
Old 01-03-2017
Hello SkySmart,

Could you please try following and let me know if this helps you.
Code:
awk '{match($0,/#growncars#.*#growncars#/);VAL=substr($0,RSTART,RLENGTH);gsub(/^#growncars#|#growncars#$/,X,VAL);gsub(/#growncars#/,"\n",VAL);print VAL}'  Input_file

Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print line if first Field matches a pattern

Hi All, I would like my code to be able to print out the whole line if 1st field has a dot in the number. Sample input and expected output given below. My AWK code is below but it can;t work, can any expert help me ? Thanks in advance. {if ($1 ~ /*\.*/) { print $0 }} Input: ... (2 Replies)
Discussion started by: Raynon
2 Replies

2. Shell Programming and Scripting

Print lines where there's no indent on the first field

Hi All, I need a code to print those lines where there's NO indents on the 1st field Example shown below. I tried to use the below codes but i am not able to see the expected result. Can any expert give any advise ? My Code cat filename| awk '$1 ~ /^+$/ {print $0}' Input 1199 ... (7 Replies)
Discussion started by: Raynon
7 Replies

3. Shell Programming and Scripting

print the last line of an recurring pattern on the 3rd field

How can i awk/sed to print the last line of an recurring pattern on the 3rd field? Input lines: 123456.1 12 1357911 11111.1 01 123456.2 12 1357911 11111.2 02 123456.3 12 1357911 11111.3 03 123456.4 12 1357911 11111.4 04 123456.5 12 1357911 11111.5 05 246810.1 12 1357911 22222.1 01... (4 Replies)
Discussion started by: ux4me
4 Replies

4. Shell Programming and Scripting

print lines up to pattern excluding pattern

11 22 33 44 55 66 77 When pattern 55 is met, print upto it, so output is 11 22 33 44 (1 Reply)
Discussion started by: anilcliff
1 Replies

5. UNIX for Dummies Questions & Answers

Match pattern in a field, print pattern only instead of the entire field

Hi ! I have a tab-delimited file, file.tab: Column1 Column2 Column3 aaaaaaaaaa bbtomatoesbbbbbb cccccccccc ddddddddd eeeeappleseeeeeeeee ffffffffffffff ggggggggg hhhhhhtomatoeshhh iiiiiiiiiiiiiiii ... (18 Replies)
Discussion started by: lucasvs
18 Replies

6. Shell Programming and Scripting

Need one liner to search pattern and print everything expect 6 lines from where pattern match made

i need to search for a pattern from a big file and print everything expect the next 6 lines from where the pattern match was made. (8 Replies)
Discussion started by: chidori
8 Replies

7. Shell Programming and Scripting

Awk: print lines with one of multiple pattern in the same field (column)

Hi all, I am new to using awk and am quickly discovering what a powerful pattern-recognition tool it is. However, I have what seems like a fairly basic task that I just can't figure out how to perform in one line. I want awk to find and print all the lines in which one of multiple patterns (e.g.... (8 Replies)
Discussion started by: elgo4
8 Replies

8. Shell Programming and Scripting

Print ALL lines except if field is 999

Hi All!!! :-) I need a command that will print each line of a text file UNLESS the 3rd field of that line is equal to the number 999. (space seperated fields) Solaris10/BASH SHELL: INPUT.TXT aaa bbb 111 222 ccc ddd 333 444 eee fff 999 555 ggg hhh 666 777 aaa bbb 999 222 ccc ddd 333... (7 Replies)
Discussion started by: ajp7701
7 Replies

9. Shell Programming and Scripting

Match Pattern and print pattern and multiple lines into one line

Hello Experts , require help . See below output: File inputs ------------------------------------------ Server Host = mike id rl images allocated last updated density vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies

10. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies
CPANPLUS::Configure(3perl)				 Perl Programmers Reference Guide				CPANPLUS::Configure(3perl)

NAME
CPANPLUS::Configure - configuration for CPANPLUS SYNOPSIS
$conf = CPANPLUS::Configure->new( ); $bool = $conf->can_save; $bool = $conf->save( $where ); @opts = $conf->options( $type ); $make = $conf->get_program('make'); $verbose = $conf->set_conf( verbose => 1 ); DESCRIPTION
This module deals with all the configuration issues for CPANPLUS. Users can use objects created by this module to alter the behaviour of CPANPLUS. Please refer to the "CPANPLUS::Backend" documentation on how to obtain a "CPANPLUS::Configure" object. METHODS
$Configure = CPANPLUS::Configure->new( load_configs => BOOL ) This method returns a new object. Normal users will never need to invoke the "new" method, but instead retrieve the desired object via a method call on a "CPANPLUS::Backend" object. load_configs Controls whether or not additional user configurations are to be loaded or not. Defaults to "true". $bool = $Configure->init( [rescan => BOOL]) Initialize the configure with other config files than just the default 'CPANPLUS::Config'. Called from "new()" to load user/system configurations If the "rescan" option is provided, your disk will be examined again to see if there are new config files that could be read. Defaults to "false". Returns true on success, false on failure. can_save( [$config_location] ) Check if we can save the configuration to the specified file. If no file is provided, defaults to your personal config. Returns true if the file can be saved, false otherwise. $file = $conf->save( [$package_name] ) Saves the configuration to the package name you provided. If this package is not "CPANPLUS::Config::System", it will be saved in your ".cpanplus" directory, otherwise it will be attempted to be saved in the system wide directory. (On Debian systems, this system wide directory is /etc/perl.) If no argument is provided, it will default to your personal config. Returns the full path to the file if the config was saved, false otherwise. options( type => TYPE ) Returns a list of all valid config options given a specific type (like for example "conf" of "program") or false if the type does not exist ACCESSORS
Accessors that start with a "_" are marked private -- regular users should never need to use these. See the "CPANPLUS::Config" documentation for what items can be set and retrieved. get_SOMETHING( ITEM, [ITEM, ITEM, ... ] ); The "get_*" style accessors merely retrieves one or more desired config options. set_SOMETHING( ITEM => VAL, [ITEM => VAL, ITEM => VAL, ... ] ); The "set_*" style accessors set the current value for one or more config options and will return true upon success, false on failure. add_SOMETHING( ITEM => VAL, [ITEM => VAL, ITEM => VAL, ... ] ); The "add_*" style accessor adds a new key to a config key. Currently, the following accessors exist: set|get_conf Simple configuration directives like verbosity and favourite shell. set|get_program Location of helper programs. _set|_get_build Locations of where to put what files for CPANPLUS. _set|_get_source Locations and names of source files locally. _set|_get_mirror Locations and names of source files remotely. _set|_get_fetch Special settings pertaining to the fetching of files. BUG REPORTS
Please report bugs or other issues to <bug-cpanplus@rt.cpan.org<gt>. AUTHOR
This module by Jos Boumans <kane@cpan.org>. COPYRIGHT
The CPAN++ interface (of which this module is a part of) is copyright (c) 2001 - 2007, Jos Boumans <kane@cpan.org>. All rights reserved. This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. SEE ALSO
CPANPLUS::Backend, CPANPLUS::Configure::Setup, CPANPLUS::Config perl v5.14.2 2014-09-29 CPANPLUS::Configure(3perl)
All times are GMT -4. The time now is 10:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy