Sponsored Content
Top Forums Shell Programming and Scripting Need help in search for word and return line Post 302619973 by jakSun8 on Friday 6th of April 2012 02:56:19 PM
Old 04-06-2012
That's amazing! .. thanks!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

to get a line above the search word

Hi Everyone. I want to get all the lines above the word error. Note some records dont have error. ex Input Rec # 2384 Client: BGA Rx No: 0735845 Error: (W)Submit Date before Fill Date(SUBMIT-DATE) I want to have the line which starts with... (16 Replies)
Discussion started by: sachin.gangadha
16 Replies

2. UNIX for Dummies Questions & Answers

query on how to search for a line and read 4th word from that line

Assume I have a text file as below: me con pi ind ken pras ur me con rome ind kent pras urs pintu con mys ind pan pras ki con kit ind sys My requirement, I need to search for "con rome" and if exists, then print 4th word from rome, i.e in above example, since "con rome"... (4 Replies)
Discussion started by: jaggesh
4 Replies

3. Shell Programming and Scripting

How to search word and get the line above it.

Hey all, Could any one help me ... I want to search the word and want the line above it. eg. mytxt.log My name is Jeevan. 240 is my address. My name is Jhon. 390 is my address. -------- i want to search "240" and want output as My name is Jeevan. 240 is my address. ... (7 Replies)
Discussion started by: Jeevan Salunke
7 Replies

4. Shell Programming and Scripting

Search string and return only the 5th line

I have looked at almost every posting on here regarding, grep, sed, awk, nawk, perl methods to perform this function, but they are just not returning the results I hope to see. Example File: abcdef 123456 ghijkl 7890123 7890123 7890123 7890123 mnopqrs 456789 This is the most... (4 Replies)
Discussion started by: doza22
4 Replies

5. Shell Programming and Scripting

Search word in a line and print earlier pattern match

Hi All, I have almost 1000+ files and I want to search specific pattern. Looking forwarded your input. Search for: word1.word2 (Which procedure contain this word, I need procedure name in output. Expected output: procedure test1 procedure test2 procedure test3 procedure test4 ... (7 Replies)
Discussion started by: susau_79
7 Replies

6. UNIX for Dummies Questions & Answers

Can grep command return word instead of complete line

Hi Is there any way GREP command can return word and not complete line. My file has following data: Hello Everyone I am NitinrajSrivastava Hi Friends Welcome VrajSrivastava I am using grep 'raj' which is returning me complete line.However I want only the word having keyword 'raj'. Required... (11 Replies)
Discussion started by: dashing201
11 Replies

7. Shell Programming and Scripting

search a string in a particular column of file and return the line number of the line

Hi All, Can you please guide me to search a string in a particular column of file and return the line number of the line where it was found using awk. As an example : abc.txt 7000,john,2,1,0,1,6 7001,elen,2,2,0,1,7 7002,sami,2,3,0,1,6 7003,mike,1,4,0,2,1 8001,nike,1,5,0,1,8... (3 Replies)
Discussion started by: arunshankar.c
3 Replies

8. Shell Programming and Scripting

Read a File line by line and split into array word by word

Hi All, Hope you guys had a wonderful weekend I have a scenario where in which I have to read a file line by line and check for few words before redirecting to a file I have searched the forum but,either those answers dint work (perhaps because of my wrong under standing of how IFS... (6 Replies)
Discussion started by: Kingcobra
6 Replies

9. Shell Programming and Scripting

Find word in a line and output in which line the word occurs / no. of times it occurred

I have a file: file.txt, which contains the following data in it. This is a file, my name is Karl, what is this process, karl is karl junior, file is a test file, file's name is file.txt My name is not Karl, my name is Karl Joey What is your name? Do you know your name and... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

10. UNIX for Beginners Questions & Answers

Search for word in huge logfile and need to continue to print few lines from that line til find date

Guys i need an idea for one logic..in shell scripting am struggling with a logic...So the thing is... i need to search for a word in a huge log file and i need to continue to print few more lines from that line and the consecutive line has to end when it finds the line with date..because i know... (1 Reply)
Discussion started by: Prathi
1 Replies
Devel::PartialDump(3pm) 				User Contributed Perl Documentation				   Devel::PartialDump(3pm)

NAME
Devel::PartialDump - Partial dumping of data structures, optimized for argument printing. VERSION
version 0.17 SYNOPSIS
use Devel::PartialDump; sub foo { print "foo called with args: " . Devel::PartialDump->new->dump(@_); } use Devel::PartialDump qw(warn); # warn is overloaded to create a concise dump instead of stringifying $some_bad_data warn "this made a boo boo: ", $some_bad_data DESCRIPTION
This module is a data dumper optimized for logging of arbitrary parameters. It attempts to truncate overly verbose data, in a way that is hopefully more useful for diagnostics warnings than warn Dumper(@stuff); Unlike other data dumping modules there are no attempts at correctness or cross referencing, this is only meant to provide a slightly deeper look into the data in question. There is a default recursion limit, and a default truncation of long lists, and the dump is formatted on one line (new lines in strings are escaped), to aid in readability. You can enable it temporarily by importing functions like "warn", "croak" etc to get more informative errors during development, or even use it as: BEGIN { local $@; eval "use Devel::PartialDump qw(...)" } to get DWIM formatting only if it's installed, without introducing a dependency. SAMPLE OUTPUT
"foo" "foo" "foo" => "bar" foo: "bar" "foo => "bar", gorch => [ 1, "bah" ]" foo: "bar", gorch: [ 1, "bah" ] "[ { foo => ["bar"] } ]" [ { foo: ARRAY(0x9b265d0) } ] "[ 1 .. 10 ]" [ 1, 2, 3, 4, 5, 6, ... ] "foo bar" "foo bar" ""foo" . chr(1)" "foox{1}" ATTRIBUTES
max_length The maximum character length of the dump. Anything bigger than this will be truncated. Not defined by default. max_elements The maximum number of elements (array elements or pairs in a hash) to print. Defaults to 6. max_depth The maximum level of recursion. Defaults to 2. stringify Whether or not to let objects stringify themselves, instead of using "StrVal" in overload to avoid side effects. Defaults to false (no overloading). pairs Whether or not to autodetect named args as pairs in the main "dump" function. If this attribute is true, and the top level value list is even sized, and every odd element is not a reference, then it will dumped as pairs instead of a list. EXPORTS
All exports are optional, nothing is exported by default. This module uses Sub::Exporter, so exports can be renamed, curried, etc. warn show show_scalar croak carp confess cluck dump See the various methods for behavior documentation. These methods will use $Devel::PartialDump::default_dumper as the invocant if the first argument is not blessed and "isa" Devel::PartialDump, so they can be used as functions too. Particularly "warn" can be used as a drop in replacement for the built in warn: warn "blah blah: ", $some_data; by importing use Devel::PartialDump qw(warn); $some_data will be have some of it's data dumped. $default_dumper The default dumper object to use for export style calls. Can be assigned to to alter behavior globally. This is generally useful when using the "warn" export as a drop in replacement for "CORE::warn". METHODS
warn @blah A wrapper for "dump" that prints strings plainly. show @blah show_scalar $x Like "warn", but instead of returning the value from "warn" it returns its arguments, so it can be used in the middle of an expression. Note that my $x = show foo(); will actually evaluate "foo" in list context, so if you only want to dump a single element and retain scalar context use my $x = show_scalar foo(); which has a prototype of "$" (as opposed to taking a list). This is similar to the venerable Ingy's fabulous and amazing XXX module. carp croak confess cluck Drop in replacements for Carp exports, that format their arguments like "warn". dump @stuff Returns a one line, human readable, concise dump of @stuff. If called in void context, will "warn" with the dump. Truncates the dump according to "max_length" if specified. dump_as_list $depth, @stuff dump_as_pairs $depth, @stuff Dump @stuff using the various formatting functions. Dump as pairs returns comma delimited pairs with "=>" between the key and the value. Dump as list returns a comma delimited dump of the values. format $depth, $value format_key $depth, $key format_object $depth, $object format_ref $depth, $Ref format_array $depth, $array_ref format_hash $depth, $hash_ref format_undef $depth, undef format_string $depth, $string format_number $depth, $number quote $string The various formatting methods. You can override these to provide a custom format. "format_array" and "format_hash" recurse with "$depth + 1" into "dump_as_list" and "dump_as_pairs" respectively. "format_ref" delegates to "format_array" and "format_hash" and does the "max_depth" tracking. It will simply stringify the ref if the recursion limit has been reached. AUTHOR
XXXX XXX'XX (Yuval Kogman) <nothingmuch@woobling.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2008 by XXXX XXX'XX (Yuval Kogman). This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. CONTRIBUTORS
o David Golden <dagolden@cpan.org> o Florian Ragwitz <rafl@debian.org> o Jesse Luehrs <doy@tozt.net> o Karen Etheridge <ether@cpan.org> o Leo Lapworth <web@web-teams-computer.local> o Steven Lee <stevenwh.lee@gmail.com> perl v5.18.2 2013-11-30 Devel::PartialDump(3pm)
All times are GMT -4. The time now is 10:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy