LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-25-2011, 10:16 AM   #16
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Arch
Posts: 10,038

Rep: Reputation: 3203Reputation: 3203Reputation: 3203Reputation: 3203Reputation: 3203Reputation: 3203Reputation: 3203Reputation: 3203Reputation: 3203Reputation: 3203Reputation: 3203

RT is what has been matched whereas RS is what you are looking for, although in this instance it is the same. I just added a blank line and still got the correct output??
 
1 members found this post helpful.
Old 03-25-2011, 02:22 PM   #17
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
gawk vs mawk

Sorry for the confusion. I just noticed that my awk points to mawk on my current system. Hence, the funny results I got which is no output at all if I use RT and the aforementioned duplicate behavior in case of an empty last line.
Running it with gawk works perfectly.
 
Old 03-25-2011, 11:59 PM   #18
jacky29
LQ Newbie
 
Registered: Mar 2011
Posts: 14

Original Poster
Rep: Reputation: 0
thankzz every one/......the code is working!!!
 
Old 03-26-2011, 01:26 AM   #19
jacky29
LQ Newbie
 
Registered: Mar 2011
Posts: 14

Original Poster
Rep: Reputation: 0
xplaintn

sed ':t /<VirtualHost/,/VirtualHost>/ { /VirtualHost>/!{ $!{ N; bt } }; /lal.com/d; }' infile





can anybody explain me this code.....plz!!!
 
0 members found this post helpful.
Old 03-26-2011, 01:52 AM   #20
jacky29
LQ Newbie
 
Registered: Mar 2011
Posts: 14

Original Poster
Rep: Reputation: 0
sed ':t /<VirtualHost/,/VirtualHost>/ { /VirtualHost>/!{ $!{ N; bt } }; /name/d; }' infile



please can anybody xplain the logic of the code!!! plzz!!
 
0 members found this post helpful.
Old 03-26-2011, 01:54 AM   #21
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Why did you double post? And didn't you learn to spell correctly like I asked yet?
 
1 members found this post helpful.
Old 03-26-2011, 02:03 AM   #22
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Nevermind about everything.... I got the following from a previous post in this thread.....
Code:
:t
/<VirtualHost/,/VirtualHost>/ { # For each line in this range
  /VirtualHost>/!{    # If not at the /VirtualHost>/ marker
    $!{               # nor the last line of the file,
      N;              # add the Next line to the pattern space
      bt
    }                 # and branch (loop back) to the :t label.
  }                   # This line matches the /VirtualHost>/ marker.
  /lal.com/d;         # If /lal.com/ matches, delete the block.
}                     # Otherwise, the block will be printed.
This explains the sed code you have been asking about. Please READ next time before you go posting new threads and posts.

And for the record, read this - http://www.grymoire.com/Unix/Sed.html
That will get you in the right direction with sed.

Cheers,

Josh
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting duplicate lines without deleting first instance of the duplicated line jkeertir Linux - Newbie 2 02-07-2011 06:55 AM
deleting a line containing the word mohamad Linux - Newbie 6 06-10-2010 04:20 PM
print second word in 1st line along with 5th word in all the lines after the first bangaram Programming 5 08-31-2009 03:42 AM
Deleting lines from a file horacioemilio Programming 16 12-18-2007 06:07 PM
deleting files containing a specific word Sleb Programming 5 05-25-2006 01:19 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration