LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-31-2008, 11:16 AM   #1
joyds219
LQ Newbie
 
Registered: Mar 2008
Posts: 9

Rep: Reputation: 0
Question Sed, Awk, grep,Search,delete


I am developing a script for a buildiing in vs2003. I want to delete Lines from Name="Franklin chest Sources" Upto Filter(as shown in bold in the below lines). I want to achieve this by using the SED Command, where it searches the line Name="Franklin chest Sources" Up to Filter & deletes it.I have tried to get the Solutions since many days but in vain. Someone please help me out.



</Filter>
<Filter
Name="Franklin chest Sources"
Filter="">
<File
RelativePath="..\..\..\AF\SHEAR\shearapi.cpp">
<FileConfiguration
Name="DLL Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="DISPLAY|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug STRIP DEBUG|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="BcProBuild|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug Single Threaded|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="DLL Release|Win32"> <Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="DLL Debug Single Threaded|Win32"> <Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="DISPLAY Release|Win32"> <Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="OptiRect Sources"
Filter="">
<File
RelativePath="..\..\..\AF\OPTIRECT\iooptrec.cpp">
<FileConfiguration
Name="DLL Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="DISPLAY|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
</FileConfiguration>
</File>
</Filter>
<Filter

Name="OptiRect Sources"
Filter="">
<File
RelativePath="..\..\..\AF\OPTIRECT\iooptrec.cpp">
<FileConfiguration
Name="DLL Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="DISPLAY|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
 
Old 03-31-2008, 12:35 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,990
Blog Entries: 54

Rep: Reputation: 2743Reputation: 2743Reputation: 2743Reputation: 2743Reputation: 2743Reputation: 2743Reputation: 2743Reputation: 2743Reputation: 2743Reputation: 2743Reputation: 2743
If this is not homework (see the LQ Rules) I suggest not only posting questions but also code or commands you're working on.
 
Old 03-31-2008, 12:39 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 62
There are multiple Filter lines. What criteria would you like to use to determine which one to stop deleting at?
 
Old 03-31-2008, 02:28 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Why the huge file?? We don't need all that to address the question....

What you want is an "address range", e.g.:
sed '/addr1/,/addr2/ d' filename
deletes lines containing addr1 thru addr2, inclusive.

Really good SED tutorial here: http://www.grymoire.com/Unix/Sed.html
 
Old 03-31-2008, 06:59 PM   #5
Tischbein
Member
 
Registered: Oct 2006
Distribution: debian
Posts: 124

Rep: Reputation: 15
Cue xml and sed:

xml2 tools are used to convert XML, HTML and CSV to and from a
line-oriented format more amenable to processing by classic Unix
pipeline processing tools, like grep, sed, awk, cut, shell scripts,
and so forth.

xml2 is available as a debian package. I'm not on a machine with xml2 but it goes something like this:

Enter a file such as:
<roof>
<beam>
<nail num=1 />
<nail num=2 />
<nail num=3 />
</beam>
</roof>
Put it through xml2 to get:
roof:
roof/beam:
roof/beam/nail@num:1
roof/beam/nail@num:2
etc
take out the nails with grep -v nail, then convert back to xml with 2xml. You don't need all that with the input I have given but my input is nicely formatted.

There is also xpath (a command line implementation of XPath) and xmlgrep.


Regards, Entenbein.
 
Old 04-03-2008, 06:15 AM   #6
joyds219
LQ Newbie
 
Registered: Mar 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Got it.Thank God

sed '/Name=\"Franklin chest Sources\"/,/<\Filter/d'
 
Old 04-03-2008, 06:15 AM   #7
joyds219
LQ Newbie
 
Registered: Mar 2008
Posts: 9

Original Poster
Rep: Reputation: 0
thanks pixellany for your help.
 
  


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
Delete specific Range of lines Using sed , awk, grep etc. joyds219 Linux - Newbie 4 03-28-2008 08:59 AM
sed/awk/grep for multiple line data hotrodmacman Programming 8 10-18-2007 11:06 AM
awk/sed to grep the text ahpin Linux - Software 3 10-17-2007 12:34 AM
diffrence between grep, sed, awk and egrep Fond_of_Opensource Linux - Newbie 3 08-18-2006 08:15 AM
How can I awk/sed/grep the IPs from the maillog? abefroman Programming 7 03-09-2006 10:22 AM


All times are GMT -5. The time now is 02:43 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration