If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Separation of lines from file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-04-10, 12:26
regtha regtha is offline
Registered User
 
Join Date: Jan 2010
Posts: 72
Separation of lines from file

Hi

I have a file with content as follows

ha106sr1 autosysdb1 0 trunc log on chkpt
ac1101qa1 IHSTORY 0 trunc log on chkpt
ab1101rs1 REPORT 0 trunc log on chkpt
ea1143rs2 cfdm01db 40 trunc log on chkpt
xye1143abr2 cfw001db 40 trunc log on chkpt
bc1143de2 digtempdb 56 trunc log on chkpt

I have to separate the lines which are non zero in the 3rd column of the file to a diff file

Thanks
Reply With Quote
  #2 (permalink)  
Old 03-04-10, 16:10
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Code:
awk '{ if ( $3 != 0 ) { print $0; } }' < input-file > result-file
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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