LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-18-2013, 01:47 AM   #1
Boopathiraj
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Rep: Reputation: Disabled
Manipulating the data in a file


All,

Please find the below file...
--------------------------------------
--------------------------------------
Code:
set command 
set command a 
set command b
set command c
set command d
set command eeasdsda
set policy
set policy a
set policy b
set policy v
set policy x
interface Ethernet0
 speed 100
 duplex full
 nameif ODCLAN
 security-level 100
 ip address 157.227.43.1 255.255.255.0 standby 157.227.43.2
!
interface Ethernet1
 speed 100
 duplex full
 nameif outside
 security-level 0
 ip address 10.0.0.1 255.255.255.248 standby 10.0.0.2
-----------------------------------------------------------
-----------------------------------------------------------

i want to seperate this file into many parts..'
1.From "set command" to "set policy" -- need to put in FILE A

2.From "set policy" to end -- need to have in FILEB

I need to do the above tasks..please suggests.

Last edited by onebuck; 02-01-2013 at 08:18 AM. Reason: show OP vbcode tags to clean up thread/post
 
Old 01-18-2013, 02:49 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Assuming that the infile provided is correct (use [code]..[/code] tages to preserve spacing etc), have a look at this:
Code:
awk '/^set command/ { print > "FILEA" } !/^set command/ { print > "FILEB"} ' infile
 
Old 01-25-2013, 05:26 AM   #3
Boopathiraj
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by druuna View Post
Assuming that the infile provided is correct (use [code]..[/code] tages to preserve spacing etc), have a look at this:
Code:
awk '/^set command/ { print > "FILEA" } !/^set command/ { print > "FILEB"} ' infile

Thanks for your reply ....
But still ..
I request for the query not filter by the starting word ...
It has to give the lines present from "this word" to "this word" ..
 
Old 01-25-2013, 06:01 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Quote:
Originally Posted by Boopathiraj View Post
Thanks for your reply ....
But still ..
I request for the query not filter by the starting word ...
It has to give the lines present from "this word" to "this word" ..
In that case:
- Provide a valid example of the input file,
- Provide an example of the wanted output file(s) based on the example input file.
 
Old 01-31-2013, 06:44 AM   #5
Boopathiraj
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by druuna View Post
In that case:
- Provide a valid example of the input file,
- Provide an example of the wanted output file(s) based on the example input file.

Hi Thanks for continues support...

Below is the file ...
----------------------------------------
Code:
.
.
.
.
.
.
applications {
    
	application TCS-ULTIMATIX-PORTS
	{
       asdfadf
    }
    
	
	application TCS-GHD-PORTS 
	{
       sdfsdfsdf
	}
    
	application TCS-IM-PORTS {
        sdfsdfsdf
    }
 
	application-set TIVOLI-TPM-PORTS {
        application TCS-GHD-PORTS;
        application TCS-ULTIMATIX-PORTS;
    }
    application-set ONSCR9PRT {
        application TCS-GHD-PORTS;
        application TCS-ULTIMATIX-PORTS;
    }
------------------------------------------------
My requirement is , need to cut the file from the word "applications" to the end of the file..

(or )

Need to cut the file from the word "applications" to the word application-set.

Last edited by onebuck; 02-01-2013 at 08:18 AM. Reason: show OP vbcode tags to clean up thread/post
 
Old 01-31-2013, 02:59 PM   #6
trey85stang
Senior Member
 
Registered: Sep 2003
Posts: 1,090

Rep: Reputation: 41
use code tags... and give an actual input and output expectation. You might want to also exlain what you have tried so far.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Manipulating data per paragraph TsubasaJM Linux - Newbie 4 08-24-2011 05:13 AM
C: Manipulating file adresswise derchris Programming 2 03-08-2011 09:17 AM
GPG - encode file while manipulating output file name itmozart Linux - Newbie 2 10-03-2009 12:28 PM
manipulating ascii data tables questions will.flanagan Linux - Newbie 8 04-17-2009 09:36 PM
LXer: Manipulating WPC Data through DAS with Eclipse LXer Syndicated Linux News 0 10-31-2006 07:33 AM


All times are GMT -5. The time now is 07:52 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