Sponsored Content
Full Discussion: grep, sed in a shell script
Top Forums Shell Programming and Scripting grep, sed in a shell script Post 68801 by Just Ice on Thursday 7th of April 2005 08:01:54 AM
Old 04-07-2005
sed needs to know what to do with "/Pearce/" ... try "/Pearce/p" ...

and no, it doesn't matter how you're getting to the unix box as you're not executing the script on your pc ... that only matters when you're starting a Xwindows application and you need to have a Xserver (i.e., exceed, cygwin, etc.) on your PC for it to work ...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using Grep in a Shell Script

Hi everyone, Im trying to write a Shell script that basically creates a set of files based on a file with many records. For example if a file called dummy has the following content: a.txt 1st line of a's text file 2nd line of a's text file 3rd line of a's text file b.txt 1st line of b's... (8 Replies)
Discussion started by: nbvcxzdz
8 Replies

2. Shell Programming and Scripting

Need shell/sed script for grep+string replacement

Hi, Let me explain the situation. There are many files in a directory and its sub-directories that conatin the string pattern "pa". I want to replace all such instances with the pattern "pranavagarwal" doing a grep "pa" `ls` does give me all the instances of the occurence of that... (3 Replies)
Discussion started by: pranavagarwal
3 Replies

3. Shell Programming and Scripting

grep in Shell script

Hello I do want to write a script which will check any errors say "-error" in the log file then have to send email to the concern person . And the concern person will correct the error . Next time if the script runs eventhough the error has been corrected it will ... (1 Reply)
Discussion started by: Krishnaramjis
1 Replies

4. Shell Programming and Scripting

assigning a multiline grep output which has been piped through sed to a shell variabl

Hi, I wish to format the output of a grep command in such a way that sed will be able to handle the newline characters held in the output. Since sed does not allow newlines to be contained in a replacement pattern, that means adding a backslash '\' character to the end of each line from... (8 Replies)
Discussion started by: timculhane
8 Replies

5. Shell Programming and Scripting

How to call last 14 characters with grep/sed in shell script.

Hi. This is my first post on the forums. I am trying to write a script that will parse a folder of files "oneverylongfilenamexyz.pdf" and create a .dat file named "oneverylongfilenamexyz.dat" with the first line of each .dat file saying variable="xyz" where xyz is the last 14 characters of $i... (4 Replies)
Discussion started by: attonbitusira
4 Replies

6. Shell Programming and Scripting

Shell script grep help

Hey there, newbie question : echo "::kmastat" | /usr/bin/mdb -k | grep Total | grep "kmem_*" Total 17326080 432853 0 Total 426508288 65458 0 Total 704757760 1572001732 0 Total ... (11 Replies)
Discussion started by: shriyer
11 Replies

7. Shell Programming and Scripting

How to grep sql error in shell script and exit the script?

I need help in the following script. I want to grep the sql errors insert into the error table and exit the shell script if there is any error, otherwise keep running the scripts. Here is my script #!/bin/csh -f source .orapass set user = $USER set pass = $PASS cd /opt/data/scripts echo... (2 Replies)
Discussion started by: allinshell99
2 Replies

8. Shell Programming and Scripting

Shell Script with Grep

Hi guys - below is my script that is checking for current file, size and timestamp. However I added a "grep" feature in it (line in red), but not getting the desired result. I am trying to acheive in output: 1. Show me the file name, timestamp, size and grep'ed words It would be a... (2 Replies)
Discussion started by: DallasT
2 Replies

9. Shell Programming and Scripting

Grep in Shell script

hi guys very new to this game so excuse my ignorance. I need to create a script that simply greps for a text string and then outputs a message depending on whether the text string is there or not. The script I have setup is below, but whenever I run it I get the following error: ... (5 Replies)
Discussion started by: ap2112
5 Replies

10. UNIX for Beginners Questions & Answers

Wget, grep, sort, sed in 1 command/script

Hi, I need to join these statements for efficiency, and without having to make a new directory for each batch. I'm annotating commands below. wget -q -r -l1 URL ^^ can't use -O - here and pipe | to grep because of -r grep -hrio "\b\+@\+\.\{2,4\}\+\b" * > first.txt ^^ Need to grep the output... (14 Replies)
Discussion started by: p1ne
14 Replies
Class::MethodMaker::V1Compat(3) 			User Contributed Perl Documentation			   Class::MethodMaker::V1Compat(3)

NAME
Class::MethodMaker::V1Compat - V1 compatibility code for C::MM SYNOPSIS
This class is for internal implementation only. It is not a public API. DESCRIPTION
Class::MethodMaker version 2 strives for backward-compatiblity with version 1 as far as possible. That is to say, classes built with version 1 should work with few if any changes. However, the calling conventions for building new classes are significantly different: this is necessary to achieve a greater consistency of arguments. Version 2 takes all arguments within a single arrayref: use Class::MethodMaker [ scalar => 'a' ]; If arguments are presented as a list, then Class::MethodMaker assumes that this is a version 1 call, and acts accordingly. Version 1 arguments are passed and internally rephrased to version 2 arguments, and passed off to the version 2 engine. Thus, the majority of version 1 calls can be upgraded to version 2 merely by rephrasing. However, there are a number of behaviours that in version 1 that are internally inconsistent. These behaviours are mimicked in version 1 mode as far as possible, but are not reproducible in version 2 (to allow version 2 clients to rely on a more internally consistent interface). Version 2 Implementations The nearest equivalent to each 1 component (slot) available in version 2 is shown below using the indicated data-structures & options to create a component called "a" that mimicks the V1 component behaviour as closely as possible: abstract use Class::MethodMaker [ abstract => 'a' ]; boolean Boolean is available as a backwards compatiblity hack, but there is currently no V2 equivalent. It is likely that some replacement mechanism will be introduced in the future, but that it will be incompatible with the version 1 boolean. code use Class::MethodMaker [ scalar => 'a' ]; Let's face it, the v1 store-if-it's-a-coderef-else-retrieve semantics are rather broken. How do you pass a coderef as argument to one of these? It is on the TODO list to recognize code as fundamental restricted type (analogous to INTEGER), which would add in a *_invoke method. copy use Class::MethodMaker [ copy => 'a' ]; The v2 method is the same as v1. counter use Class::MethodMaker [ scalar => [{-type => Class::MethodMaker::Constants::INTEGER}, 'a'] ]; copy deep_copy use Class::MethodMaker [ copy => [ -deep => 'a' ] ]; get_concat use Class::MethodMaker [ scalar => [{ -store_cb => sub { defined $_[1] ? ( defined $_[3] ? "$_[3] $_[1]" : $_[1] ) : undef; } }, 'a' ] ]; get_set use Class::MethodMaker [ scalar => 'a' ]; hash use Class::MethodMaker [ hash => 'a' ]; key_attrib Although v1 calls will continue to work, this is not supported in v2. key_with_create Although v1 calls will continue to work, this is not supported in v2. list use Class::MethodMaker [ list => 'a' ]; Note that the "*" method now sets the whole array if given arguments. method See "code". new use Class::MethodMaker [ new => 'a' ]; new_hash_init use Class::MethodMaker [ new => [ -hash => 'a' ] ]; new_hash_with_init use Class::MethodMaker [ new => [ -hash => -init => 'a' ] ]; new_with_args Although v1 calls will continue to work, this is not supported in v2, for it is a trivial application of "new_with_init". new_with_init use Class::MethodMaker [ new => [ -init => 'a' ] ]; object use Class::MethodMaker [ scalar => [{ -type => 'MyClass', -forward => [qw/ method1 method2 /] }, 'a' ] ]; object_tie_hash use Class::MethodMaker [ hash => [{ -type => 'MyClass', -forward => [qw/ method1 method2 /], -tie_class => 'Tie::MyTie', -tie_args => [qw/ foo bar baz /], }, 'a' ] ]; object_tie_list use Class::MethodMaker [ array => [{ -type => 'MyClass', -forward => [qw/ method1 method2 /], -tie_class => 'Tie::MyTie', -tie_args => [qw/ foo bar baz /], }, 'a' ] ]; set_once use Class::MethodMaker [ scalar => [{ -store_cb => sub { die "Already stored $_[3]" if @_ > 3; } }, 'a' ] ]; set_once_static use Class::MethodMaker [ scalar => [{ -store_cb => sub { die "Already stored $_[3]" if @_ > 3; }, -static => 1, }, 'a' ] ]; singleton use Class::MethodMaker [ new => [ -singleton => -hash => -init => 'a' ] ]; static_get_set use Class::MethodMaker [ scalar => [ -static => 'a' ], ]; static_hash use Class::MethodMaker [ hash => [ -static => 'a' ], ]; static_list use Class::MethodMaker [ list => [ -static => 'a' ], ]; tie_hash use Class::MethodMaker [ hash => [ { -tie_class => 'MyTie', -tie_args => [qw/ foo bar baz /], } => 'a' ], ]; tie_list use Class::MethodMaker [ array => [ { -tie_class => 'MyTie', -tie_args => [qw/ foo bar baz /], } => 'a' ], ]; tie_scalar use Class::MethodMaker [ scalar => [ { -tie_class => 'MyTie', -tie_args => [qw/ foo bar baz /], } => 'a' ], ]; Caveats & Expected Breakages The following version 1 component (slot) types are not currently supported in version 2: grouped_fields hash_of_lists listed_attrib struct EXAMPLES
BUGS
REPORTING BUGS
Email the development mailing list "class-mmaker-devel@lists.sourceforge.net". AUTHOR
Martyn J. Pearce COPYRIGHT
Copyright (c) 2003, 2004 Martyn J. Pearce. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
perl v5.12.1 2008-12-03 Class::MethodMaker::V1Compat(3)
All times are GMT -4. The time now is 11:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy