Sponsored Content
Full Discussion: Print the previous line
Top Forums Shell Programming and Scripting Print the previous line Post 302435832 by radoulov on Thursday 8th of July 2010 09:32:13 AM
Old 07-08-2010
OK, just use nawk instead of awk.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print previous, current and next line using sed

Hi, how can i print the previous, current and next line using sed? current line is the matching line. The following prints all lines containing 'Failure' and also the immediate next line cat $file | sed -n -e '/Failure/{N;p;}' Now, i also want to print the previous line too. Thanks,... (8 Replies)
Discussion started by: ysrinu
8 Replies

2. Shell Programming and Scripting

How to use sed to search for string and Print previous two lines and current line

Hello, Can anybody help me to correct my sed syntax to find the string and print previous two lines and current line and next one line. i am using string as "testing" netstat -v | sed -n -e '/test/{x;2!p;g;$!N;p;D;}' -e h i am able to get the previous line current line next line but... (1 Reply)
Discussion started by: nmadhuhb
1 Replies

3. Shell Programming and Scripting

how Print previous line ..........

HELLO...I wanted to ask you, than sure know unix more than me, as I can obtain the following solution: I have a file with rows of the type: CIAO COME STAI PERCHE COME STAI CIAO COME VA ALLO CHE FACCIAMO ................. I would that if in a line is present the word (for example) " CHE... (9 Replies)
Discussion started by: fabi20
9 Replies

4. UNIX for Dummies Questions & Answers

Awk to print data from current and previous line

Hi guys, I have found your forum super useful. However, right now I am stuck on a seemingly "simple" thing in AWK. I have two columns of data, the first column in Age (in million years) and the second column is Convergence Rate (in mm/yr). I am trying to process my data so I can use it to... (2 Replies)
Discussion started by: awk_noob_456
2 Replies

5. Shell Programming and Scripting

Print a field from the previous line

plz help me!! I have this file , 3408 5600 3796 6035 4200 6285 4676 0 40 1554 200 1998 652 2451 864 2728 1200 0 I want it like if $2==0,replace it with field from the previous line+500 say here the o/p would be like 3408 5600 3796 6035 4200 6285... (16 Replies)
Discussion started by: Indra2011
16 Replies

6. Shell Programming and Scripting

print range of lines matching pattern and previous line

Hi all, on Solaris 10, I'd like to print a range of lines starting at pattern but also including the very first line before pattern. the following doesn't print the range starting at pattern and going down to the end of file: cat <my file> | sed -n -e '/<pattern>{x;p;}/' I need to include the... (1 Reply)
Discussion started by: siriche
1 Replies

7. Shell Programming and Scripting

awk script -print line when $2 > $2 of previous line

Hi all, From a while loop I am reading a sorted file where I want to print only the lines that have $1 match and $2 only when the difference from $2 from the previous line is > 30. Input would be like ... AN237 010 193019 0502 1 CSU Amoxycillin AN237 080 ... (2 Replies)
Discussion started by: gafoleyo73
2 Replies

8. Shell Programming and Scripting

How to print previous line of multiple pattern matched line?

Hello, I have below format log file, Comparing csv_converted_files/2201/9747.1012H67126.5077292103609547345.csv and csv_converted_files/22019/97447.1012H67126.5077292103609547345.csv Comparing csv_converted_files/2559/9447.1012H67126.5077292103609547345.csv and... (6 Replies)
Discussion started by: arvindshukla81
6 Replies

9. AIX

Print nth previous line after match

Please help me print nth line after match awk or sed one line command. (3 Replies)
Discussion started by: sushma123
3 Replies

10. UNIX for Beginners Questions & Answers

awk or sed to print the character from the previous line after the regexp match

Hi All, I need to print the characters in the previous line just before the regular expression match Please have a look at the input file as attached I need to match the regular expression ^ with the character of the previous like and also the pin numbers and the output file should be like... (6 Replies)
Discussion started by: kshitij
6 Replies
CPANPLUS::Internals::Search(3pm)			 Perl Programmers Reference Guide			  CPANPLUS::Internals::Search(3pm)

NAME
CPANPLUS::Internals::Search SYNOPSIS
my $aref = $cpan->_search_module_tree( type => 'package', allow => [qr/DBI/], ); my $aref = $cpan->_search_author_tree( type => 'cpanid', data => @old_results, verbose => 1, allow => [qw|KANE AUTRIJUS|], ); my $aref = $cpan->_all_installed( ); DESCRIPTION
The functions in this module are designed to find module(objects) based on certain criteria and return them. METHODS
_search_module_tree( type => TYPE, allow => @regexes, [data => @previous_results ] ) Searches the moduletree for module objects matching the criteria you specify. Returns an array ref of module objects on success, and false on failure. It takes the following arguments: type This can be any of the accessors for the "CPANPLUS::Module" objects. This is a required argument. allow A set of rules, or more precisely, a list of regexes (via "qr//" or plain strings), that the "type" must adhere too. You can specify as many as you like, and it will be treated as an "OR" search. For an "AND" search, see the "data" argument. This is a required argument. data An arrayref of previous search results. This is the way to do an "AND" search -- "_search_module_tree" will only search the module objects specified in "data" if provided, rather than the moduletree itself. _search_author_tree( type => TYPE, allow => @regexex, [data => @previous_results ] ) Searches the authortree for author objects matching the criteria you specify. Returns an array ref of author objects on success, and false on failure. It takes the following arguments: type This can be any of the accessors for the "CPANPLUS::Module::Author" objects. This is a required argument. allow A set of rules, or more precisely, a list of regexes (via "qr//" or plain strings), that the "type" must adhere too. You can specify as many as you like, and it will be treated as an "OR" search. For an "AND" search, see the "data" argument. This is a required argument. data An arrayref of previous search results. This is the way to do an "and" search -- "_search_author_tree" will only search the author objects specified in "data" if provided, rather than the authortree itself. _all_installed() This function returns an array ref of module objects of modules that are installed on this system. perl v5.12.1 2010-04-26 CPANPLUS::Internals::Search(3pm)
All times are GMT -4. The time now is 05:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy