The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Special Forums > Windows & DOS: Issues & Discussions
.
google unix.com



Windows & DOS: Issues & Discussions All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Extracting data from text file based on configuration set in config file suparnbector Shell Programming and Scripting 3 08-10-2007 03:25 AM
Exporting text file data to csv l_jayakumar Shell Programming and Scripting 3 09-19-2005 12:27 AM
filter data deep.singh UNIX for Dummies Questions & Answers 3 08-15-2005 12:24 AM
How to extract data from a text file negixx Shell Programming and Scripting 1 07-19-2005 10:30 PM
getting data out from a text file skotapal Shell Programming and Scripting 7 09-14-2002 12:10 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-28-2007
b_sri b_sri is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 5
Filter data from text file

Hi All

We have got a text file, which has data dumped from 60 tables.
From these 60 tables of data we need data from 4 tables only.

I tried assigning line numbers to filter out data, but it is not working as intended.

below is the sample file

----Table1-----
3,dfs,43,df
4,sd,5,edd
56,df,6,fgdg
---Table2---
54,fdgfg,fgdfg
65,dgdfg,yuytr
76,tyuuu,ytur
---Table3----
98,rere,78
87,gdg,87
45,hgff,98
---Table4---
sdfsd,tyut,676
ffsdf,ggfd,879
ghgf,iyuty,877

Say from the file, i need to filter out data for Table2 and Table 3 only ...

Can any suggest a solution for this ..

Thanks in Advance
Sri....
  #2 (permalink)  
Old 06-28-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695

Code:
csplit -k input_file /Table/ {99}

  #3 (permalink)  
Old 06-28-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398

Code:
sed -n -e "/Table2/,/^--/{/^--/!p;/Table2/p;}" -e "/Table3/,/^--/{/^--/!p;/Table3/p;}" file

  #4 (permalink)  
Old 07-09-2007
b_sri b_sri is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 5
Thanks a Ton .. The Seds statement is working
  #5 (permalink)  
Old 04-14-2008
Hone1975 Hone1975 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 7
how to???

Hi,

OK. This is part of solutions what I need.
How I can filter out only those tables where is information like IP=172.18.0.1?
  #6 (permalink)  
Old 04-14-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Without an example, it's hard to guess. The example you posted so far only has 12345 and asdfghjkl, which of those is supposed to be an IP address?

Maybe it would be easier if you split the single file into multiple files first. Then it's a simple matter of grep -l IP=whatever files
Closed Thread

Bookmarks

Tags
solaris

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:47 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0