Visit Our UNIX and Linux User Community

Top Forums Shell Programming and Scripting Going mad on an egrep command (Reg Expressions) Post 303019467 by jim mcnamara on Friday 29th of June 2018 02:21:45 PM
Old 06-29-2018
try egrep -oh (pattern) filename
Code:
#example:
Owner@Owner-PC ~
$ egrep -oh '(LastName)' Edit1.txt
LastName
LastName
LastName
LastName
LastName
LastName

Owner@Owner-PC ~
$ cat Edit1.txt
FOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOLastName^^^^^^^^FFF
abc LastName ABC
LastName
abc LastName abc

abcLastName
LastNameabc

This User Gave Thanks to jim mcnamara For This Post:
 
Test Your Knowledge in Computers #209
Difficulty: Medium
The development work for OSPF prior to its publication as open standard was undertaken largely by the Digital Equipment Corporation.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

SCO vs Linux Reg Expressions Problem

Hi there, I'm investigating migrating a system currently running Scos osr5 to Linux (eg RH 7.2) but there are a lot of in house scripts, some of which are probably using "Sco specific" constructs etc. One I have come across is as follows, if ????? ] then ....etc.etc fi The regular... (2 Replies)
Discussion started by: pcs7088
2 Replies

2. UNIX for Dummies Questions & Answers

reg script command....

hi frnds, i need all ur help guys.. I am facing problem when i give script < file name> command whenever i give this command,i get an error message indicating "Openpty failed. Terminated" :confused: can u help me out... with regds, Deep (7 Replies)
Discussion started by: deep
7 Replies

3. UNIX for Dummies Questions & Answers

Reg getdents command in linux

Hi frnds, i need ur help reg getdents command which is used to read the directory entries. I need to know the exact usage of the command and any sample code reg the usage of getdents command ------------- deep :confused: (1 Reply)
Discussion started by: deep
1 Replies

4. Solaris

doubt reg prstat command

Hi, Can anyone explain me what is RSS time in the prstat output. In the below example 93M is total process size(correct me if am wrong ) what abt 58M? 1693 root 93M 58M cpu1 0 10 4:11:02 0.8% java/35 (2 Replies)
Discussion started by: rogerben
2 Replies

5. Solaris

doubt reg mailx command

Hi, Am trying to send mail from solaris host to my mailbox, but while executing mailx command am getting the follow error.Is this syntax corect? #mailx -s "subject" <myid> The flags you gave are used only when sending mail. (1 Reply)
Discussion started by: rogerben
1 Replies

6. Shell Programming and Scripting

Help with egrep command

Hi All, I am using egrep command to search one pattern. Following is the command i am using egrep -i "ACL*" filename but its also giving me the records which do not contain ACL. any help would be appreciated. Regards, Sam (3 Replies)
Discussion started by: sam25
3 Replies

7. Shell Programming and Scripting

Reg expressions

Hi, I would like to grep for a string within a tag, can someone provide some assistance in how to do it? So I would like to use the grep command to find a string like: <tag>sometext<tag> because the sometext can be any number of characters or an type of number or lettering, what expression... (1 Reply)
Discussion started by: cyberfrog
1 Replies

8. Shell Programming and Scripting

Bash script - coloring reg. expressions in text

Hi all, is there anyone good at bash who will help me? I need to use syntax ${string/pattern/replacement} The problematic part where I am stuck is: #!bin/bash text="A cat is on a mat." exp="cat" newexp="SOMECODEcatSOMECODE" newtext=${${text}/${exp}/${newexp}} == > ERROR "wrong... (4 Replies)
Discussion started by: JohnnyM77
4 Replies

9. Shell Programming and Scripting

Using egrep to output expressions which are not found

Hi, Im using the below command to search a file for multiple expressions if the 4th expression doesnt exist the command simply lists what it can find and ignores what it cant. Is there any way to get the command to output an error or a message if it cant find the 4th expression to a file? ... (16 Replies)
Discussion started by: 02JayJay02
16 Replies

10. Shell Programming and Scripting

Problems with reg.-expressions in a awk-search-pattern

Hi, i have some problems with regular expressions in a awk search pattern. what i want to do: i want to calculate the mean-value in the time from 00:00 to 06:00 how my data looks like: .... 04/01/13-01:40 670992 54802 80711 116460 156177 04/01/13-01:50 703725 60150 85498 ... (3 Replies)
Discussion started by: IMPe
3 Replies
RoPkg::Object(3pm)					User Contributed Perl Documentation					RoPkg::Object(3pm)

NAME
RoPkg::Object VERSION
0.3.2 DESCRIPTION
RoPkg::Object is a general pourpose module, designed for Get/Set objects on which you don't want to spend your time writing annoying Get/Set methods. The primary use of the module is to be a base class. SYNOPSIS
package RoPkg::Person; use strict; use warnings; use RoPkg::Object; use base qw(RoPkg::Object); $pf = { FirstName => 'A person first name', LastName => 'A person last name' }; sub new { my ($class, %opt) = @_; my $self; $self = $class->SUPER::new(%opt); $self->{methods} = $pf; $self->_inject(); return $self; } 1; tester.pl #!/usr/bin/perl use strict; use warnings; use English qw(-no_match_vars); use RoPkg::Person; sub main { my $p = new RoPkg::Person(); $p->FirstName('John'); $p->LastName('Doe'); print $p->FirstName,' ',$p->LastName,$RS; } main(); SUBROUTINES
/METHODS All methods (besides new()) raise OutsiteClass exception if called outside a class instance. Each method, may raise other exceptions. Please read the documentation of that method for aditional information. new() The class contructor. At this moment the constructor does nothing (besides bless). key($value) Search into methods list for a entry those value is $value. Returns the method name or 0 if such a method was not found. methods() In list context this method will return a list of method names. In scalar context returns just the number of methods. Please note that only the valid methods are considered (tested with can($method_name)). chkp(@plist) Check the current object if the parameters specified in the list are defined. If a parameter is not defined a Param::Missing exception is raised. SUBCLASSING
As said before, this module is specially used as a base class for those objects with many SET/GET methods. How can you use this class in your project ? As seen in the SYNOPSIS, when you create the new class, in the class constructor you call for $self->_inject method, who create (at runtime) the new methods. The list of methods who are gonna be created is actually a hash reference. A method can be specified like this: FirstName => q{-} This means, that _inject will create a get/set method named FirstName. There are some key values with special meaning: *) __exclude__ - the method with this value will not be created by _inject *) q{} - the method with this value will not be created by _inject If a existing method is available in the class and is also included in the list of methods who will be created by _inject, that method will be ignored by _inject. Each method created by _inject() has the following code: sub { my ($self, $pval) = @_; if ( !blessed($self) ) { OutsideClass->throw('Called outside class instance'); } if ( defined $pval) { $self->{$method_name} = $pval; } return $self->{$method_name}; }; DEPENDENCIES
RoPkg::Object require perl 5.008 or later and the Scalar::Util module. To run the tests you also need: *) Test::More *) Test::Pod *) Test::Pod::Coverage DIAGNOSTICS
This module is subject of tests. To run those tests, unpack the source and use the following command: make test CONFIGURATION AND ENVIRONMENT
This module does not use any configuration file or environment variables. INCOMPATIBILITIES
None known to the author BUGS AND LIMITATIONS
No known bugs. If you find one please send a detailed report to me. Please note that the methods are not automatically created. One must manual call (inside the child object) the method who "injects" the new methods. PERL CRITIC
This module is perl critic level 1 compliant with 2 exceptions. AUTHOR
Subredu Manuel <diablo@iasi.roedu.net> LICENSE AND COPYRIGHT
Copyright (C) 2005 Subredu Manuel. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license. perl v5.8.8 2006-06-09 RoPkg::Object(3pm)

Featured Tech Videos

All times are GMT -4. The time now is 05:36 PM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy