The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
unable to filter out blank lines ^$ matches nothing venkatkk UNIX for Advanced & Expert Users 5 02-08-2008 10:27 AM
how do I filter double lines from a txt file I-1 Shell Programming and Scripting 10 02-20-2007 01:21 PM
need help--script to filter specific lines from multiple txt files I-1 Shell Programming and Scripting 7 02-16-2007 08:42 PM
cutting unwanted text sysgate Shell Programming and Scripting 2 11-29-2006 05:43 AM
creation of unwanted directory mridula High Level Programming 6 10-05-2005 12:40 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-09-2007
Raynon Raynon is offline
Registered User
  
 

Join Date: Sep 2006
Location: Sg
Posts: 350
Filter unwanted lines

Hi All,

I have the below input and i only want to filter out some un-wanted info from here. Expected output is below. Can somebody help ?

The catch is that i want to grep those lines with term "k=" and lines with term "**" as the 1st column and "07" as the last column. And the number of unwanted lines in between the wanted lines are random. On top of that, the number of field of the wanted lines are also random.
Expected output shown below.


Input:
aaa k= aaaa
dddd
dddd
bbb k= cccc
zzz
zzz
zzzzz
ggg k= pppp
vvvvvv
vvv
v
vvvvv
vvvvvv
** XXXXX ZZZ VVV 07
** ccc kkk lll
** ggg lll ppp
** hhh iii kkk
xxxxxx
mmm k= qqqq
xxxxx
ddd
eee k= yyyy
ffff
ff
rrr k= vvvv
ttt
gggggg
zzzzz

Expected Output:
aaa k= aaaa
bbb k= cccc
ggg k= pppp
** XXXXX ZZZ VVV 07
mmm k= qqqq
eee k= yyyy
rrr k= vvvv
 

Bookmarks

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 09:03 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