Sponsored Content
Top Forums Shell Programming and Scripting help on shell script to check line Post 302528443 by Tytalus on Tuesday 7th of June 2011 06:17:03 AM
Old 06-07-2011
Code:
#  nawk '$0~":"&&t!=""{print $0" is incorrect format"}{t=$0}' infile
Banana: is incorrect format

HTH
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

check in unix shell script so that no one is able to run the script manually

I want to create an automated script which is called by another maually executed script. The condition is that the no one should be able to manually execute the automated script. The automated script can be on the same machine or it can be on a remote machine. Can any one suggest a check in the... (1 Reply)
Discussion started by: adi_bang76
1 Replies

2. Shell Programming and Scripting

check my first shell script

I have written the below script to determine whether a string is palindrome or not ? But its not working, any help to debug it ? I am new to this forum but when I searched for my question, I found that many people refused to answer this question thinking that its Homework question, Therefore I... (2 Replies)
Discussion started by: gridview
2 Replies

3. Shell Programming and Scripting

IP check with shell script

hi guys ..newbie here i would like to create a simple script tat will detect wether the machine has IP or not ... but it seems that my script doesnt really work it kept rebooting... i set this script during boot so that it will check else it will reboot it a shell script thou... ... (5 Replies)
Discussion started by: bladez
5 Replies

4. Shell Programming and Scripting

how to check which line of the script is showing the error

how to check which line of the script is showing the error... like -x will print each output in stdout... but want to know exact error line trowing error.. (2 Replies)
Discussion started by: mail2sant
2 Replies

5. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

6. Shell Programming and Scripting

get the fifth line of a text file into a shell script and trim the line to extract a WORD

FOLKS , i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one. thanks... Venu (3 Replies)
Discussion started by: venu
3 Replies

7. Shell Programming and Scripting

shell script to check blank line?

Can someone help to transform the below logic into a shell script, might be easy for some of you. I have a file with below text, I need if the line has the ":" and the above to it is not a blank line should print " <text>: is incorrect format" Apple: vitamin = A... (0 Replies)
Discussion started by: usyseng
0 Replies

8. Shell Programming and Scripting

Bash shell script to check if script itself is running

hi guys we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies

9. Shell Programming and Scripting

How to check line existence in shell ?

Hi, We have some config file and there we are looking to append a line if it is not found. abc.conf authpriv.* /var/log/secure mail.* -/var/log/maillog *.debug @vxhgt-hskhng02 cron.* ... (12 Replies)
Discussion started by: Litu19
12 Replies

10. Shell Programming and Scripting

Shell script to check line end not ending with comma

I have several line in a text file. for example I like apple; I like apple I like orange; Output: I like apple I try to useif grep -q "!\;$"; then (Not work) Please use CODE tags when displaying sample input, sample output, and code segments (as required by forum rules). (1 Reply)
Discussion started by: cmdcmd
1 Replies
Package::Pkg(3pm)					User Contributed Perl Documentation					 Package::Pkg(3pm)

NAME
Package::Pkg - Handy package munging utilities VERSION
version 0.0020 SYNOPSIS
First, import a new keyword: "pkg" use Package::Pkg; Package name formation: pkg->name( 'Xy', 'A' ) # Xy::A pkg->name( $object, qw/ Cfg / ); # (ref $object)::Cfg Subroutine installation: pkg->install( sub { ... } => 'MyPackage::myfunction' ); # myfunction in MyPackage is now useable MyPackage->myfunction( ... ); Subroutine exporting: package MyPackage; use Package::Pkg; sub this { ... } # Setup an exporter (literally sub import { ... }) for # MyPackage, exporting 'this' and 'that' pkg->export( that => sub { ... }, 'this' ); package main; use MyPackage; this( ... ); that( ... ); DESCRIPTION
Package::Pkg is a collection of useful, miscellaneous package-munging utilities. Functionality is accessed via the imported "pkg" keyword, although you can also invoke functions directly from the package ("Package::Pkg") USAGE
pkg->install( ... ) Install a subroutine, similar to Sub::Install This method takes a number of parameters and also has a two- and three-argument form (see below) # Install an anonymous subroutine as Banana::magic pkg->install( code => sub { ... } , as => 'Banana::magic' ) pkg->install( code => sub { ... } , into => 'Banana::magic' ) # Bzzzt! Throws an error! # Install the subroutine Apple::xyzzy as Banana::magic pkg->install( code => 'Apple::xyzzy', as => 'Banana::magic' ) pkg->install( code => 'Apple::xyzzy', into => 'Banana', as => 'magic' ) pkg->install( from => 'Apple', code => 'xyzzy', as => 'Banana::magic' ) pkg->install( from => 'Apple', code => 'xyzzy', into => 'Banana', as => 'magic' ) # Install the subroutine Apple::xyzzy as Banana::xyzzy pkg->install( code => 'Apple::xyzzy', as => 'Banana::xyzzy' ) pkg->install( code => 'Apple::xyzzy', into => 'Banana' ) pkg->install( from => 'Apple', code => 'xyzzy', as => 'Banana::xyzzy' ) pkg->install( from => 'Apple', code => 'xyzzy', into => 'Banana' ) With implicit "from" (via "caller()") package Apple; sub xyzzy { ... } # Install the subroutine Apple::xyzzy as Banana::xyzzy pkg->install( code => 'xyzzy', as => 'Banana::xyzzy' ) # 'from' is implicitly 'Apple' pkg->install( code => &xyzzy, as => 'Banana::xyzzy' ) Acceptable parameters are: code A subroutine reference, A package-with-name identifier, or The name of a subroutine in the calling package from (optional) A package identifier If :code is an identifier, then :from is the package where the subroutine can be found If :code is an identifier and :from is not given, then :from is assumed to be the calling package (via caller()) as The name of the subroutine to install as. Can be a simple name (when paired with :into) or a full package-with-name into (optional) A package identifier If :as is given, then the full name of the installed subroutine is (:into)::(:as) If :as is not given and we can derive a simple name from :code (It is a package-with-name identifier), then :as will be the name identifier part of :code pkg->install( $code => $as ) This is the two-argument form of subroutine installation Install $code subroutine as $as pkg->install( sub { ... } => 'Banana::xyzzy' ) pkg->install( 'Scalar::Util::blessed' => 'Banana::xyzzy' ) pkg->install( 'Scalar::Util::blessed' => 'Banana::' ) pkg->install( sub { ... } => 'Banana::' ) # Bzzzt! Throws an error! $code should be: o A CODE reference sub { ... } o A package-with-name identifier Scalar::Util::blessed o The name of a subroutine in the calling package sub xyzzy { ... } pkg->install( 'xyzzy' => ... ) $as should be: o A package-with-name identifier Acme::Xyzzy::magic o A package identifier (with a trailing ::) Acme::Xyzzy:: pkg->install( $code => $into, $as ) This is the three-argument form of subroutine installation pkg->install( sub { ... } => 'Banana', 'xyzzy' ) pkg->install( sub { ... } => 'Banana::', 'xyzzy' ) pkg->install( 'Scalar::Util::blessed' => 'Banana', 'xyzzy' ) pkg->install( 'Scalar::Util::blessed' => 'Banana::', 'xyzzy' ) $code can be the same as the two argument form $into should be: o A package identifier (trailing :: is optional) Acme::Xyzzy:: Acme::Xyzzy $as should be: o A name (the name of the subroutine) xyzzy magic $package = pkg->name( $part, [ $part, ..., $part ] ) Return a namespace composed by joining each $part with "::" Superfluous/redundant "::" are automatically cleaned up and stripped from the resulting $package If the first part leads with a "::", the the calling package will be prepended to $package pkg->name( 'Xy', 'A::', '::B' ) # Xy::A::B pkg->name( 'Xy', 'A::' ) # Xy::A:: { package Zy; pkg->name( '::', 'A::', '::B' ) # Zy::A::B pkg->name( '::Xy::A::B' ) # Zy::Xy::A::B } In addition, if any part is blessed, "name" will resolve that part to the package that the part makes reference to: my $object = bless {}, 'Xyzzy'; pkg->name( $object, qw/ Cfg / ); # Xyzzy::Cfg SEE ALSO
Sub::Install Sub::Exporter AUTHOR
Robert Krimen <robertkrimen@gmail.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Robert Krimen. 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-15 Package::Pkg(3pm)
All times are GMT -4. The time now is 02:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy