Sponsored Content
Top Forums Shell Programming and Scripting sed command to replace a line at a specific line number with some other line Post 302797749 by vivek d r on Tuesday 23rd of April 2013 06:14:29 AM
Old 04-23-2013
thanks guys.. works good :-)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding a columnfrom a specifit line number to a specific line number

Hi, I have a huge file & I want to add a specific text in column. But I want to add this text from a specific line number to a specific line number & another text in to another range of line numbers. To be more specific: lets say my file has 1000 lines & 4 Columns. I want to add text "Hello"... (2 Replies)
Discussion started by: Ezy
2 Replies

2. Shell Programming and Scripting

using sed to replace a specific string on a specific line number using variables

using sed to replace a specific string on a specific line number using variables this is where i am at grep -v WARNING output | grep -v spawn | grep -v Passphrase | grep -v Authentication | grep -v '/sbin/tfadmin netguard -C'| grep -v 'NETWORK>' >> output.clean grep -n Destination... (2 Replies)
Discussion started by: todd.cutting
2 Replies

3. Shell Programming and Scripting

How would i delete a line at specific line number

Hi guys , I m writing a script to delete a line at particular location. But i m unable to use variable for specifying line number. for example. sed -n '7!p' filename works fine and deletes 7th line from my file but sed -n '$variable!p' filename gives following error. sed: -e... (12 Replies)
Discussion started by: pinga123
12 Replies

4. Shell Programming and Scripting

sed script - print the line number along with the line

Hi, I want to print the line number with the pattern of the line on a same line using multi-patterns in sed. But i don't know how to do it. For example, I have a file abc def ghi I want to print 1 abc 2 def 3 ghi I know how to write it one line code, but i don't know how to put... (11 Replies)
Discussion started by: ntpntp
11 Replies

5. Shell Programming and Scripting

Replace specific field on specific line sed or awk

I'm trying to update a text file via sed/awk, after a lot of searching I still can't find a code snippet that I can get to work. Brief overview: I have user input a line to a variable, I then find a specific value in this line 10th field in this case. After asking for new input and doing some... (14 Replies)
Discussion started by: crownedzero
14 Replies

6. Shell Programming and Scripting

I need to know how to replace a line after a pattern match with an empty line using SED

Hi How Are you? I am doing fine! I need to go now? I will see you tomorrow! Basically I need to replace the entire line containing "doing" with a blank line: I need to the following output: Hi How Are you? I need to go now? I will see you tomorrow! Thanks in advance.... (1 Reply)
Discussion started by: sags007_99
1 Replies

7. Shell Programming and Scripting

sed to replace specific positions on line with file contents

Hi, I am trying to use an awk command to replace specific character positions on a line beginning with 80 with contents of another file. The line beginning with 80 in file1 is as follows: I want to replace the 000000000178800 (positions 34 - 49) on this file with the contents of... (2 Replies)
Discussion started by: nwalsh88
2 Replies

8. Shell Programming and Scripting

Multiple line search, replace second line, using awk or sed

All, I appreciate any help you can offer here as this is well beyond my grasp of awk/sed... I have an input file similar to: &LOG &LOG Part: "@DB/TC10000021855/--F" &LOG &LOG &LOG Part: "@DB/TC10000021852/--F" &LOG Cloning_Action: RETAIN &LOG Part: "@DB/TCCP000010713/--A" &LOG &LOG... (5 Replies)
Discussion started by: KarmaPoliceT2
5 Replies

9. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies

10. Shell Programming and Scripting

Replace values in script reading line by line using sed

Hi all, Let's say I have a script calling for the two variables PA_VALUE and PB_VALUE. for pa in PA_VALUE blah blah do for pb in PB_VALUE blah blah do I have a text file with two columns of values for PA and PB. 14.5 16.7 7.8 9.5 5.6 3.6 etc etc I would like to read this... (7 Replies)
Discussion started by: crimsonengineer
7 Replies
Email::Received(3pm)					User Contributed Perl Documentation				      Email::Received(3pm)

NAME
Email::Received - Parse an email Received: header SYNOPSIS
use Email::Received; for ($mail->header("Received")) { my $data = parse_received($_); return "SPAM" if rbl_lookup($data->{ip}); } DESCRIPTION
This module is a Perl Email Project rewrite of SpamAssassin's email header parser. We did this so that the great work they did in analysing pretty much every possible Received header format could be used in applications other than SpamAssassin itself. The module provides one function, "parse_received", which takes a single Received line. It then produces either nothing, if the line is unparsable, a hash reference like this: { reason => "gateway noise" } if the line should be ignored for some good reason, and one like this: { ip => '64.12.136.4', id => '875522', by => 'xxx.com', helo => 'imo-m01.mx.aol.com' } if it parsed the message. Possible keys are: ip rdns helo ident envfrom auth by id RULE FORMAT
Where SpamAssassin used a big static subroutine full of regular expressions to parse the data, we build up a big subroutine full of regular expressions dynamically from a set of rules. The rules are stored at the bottom of this module. The basic format for a rule looks like this: ((var=~)?/REGEXP/)? [ACTION; ]+ The "ACTION" is either "SET variable = $value", "IGNORE "reason"?", "UNPARSABLE" or "DONE". One control structure is provided, which is basically an "if" statement: GIVEN (NOT)? /REGEXP/ { ACTION+ } EXPORT parse_received SEE ALSO
Mail::SpamAssassin::Message::Metadata::Received, from which the rules and some of the IP address matching constants were blatantly stolen. Thanks, guys, for doing such a comprehensive job! AUTHOR
simon, <simon@> COPYRIGHT AND LICENSE
Copyright (C) 2006 by simon This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available. perl v5.10.0 2006-03-24 Email::Received(3pm)
All times are GMT -4. The time now is 02:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy