The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
extract and format information from a file sujoy101 Shell Programming and Scripting 12 04-16-2008 07:58 AM
How to extract a piece of information from a huge file Marcor Shell Programming and Scripting 2 03-13-2008 04:33 PM
I need a ton of information.... markforsythe AIX 1 08-02-2004 10:17 AM
NEED Some Information!!! btx High Level Programming 1 01-25-2004 06:50 PM
How do you extract the information from a library? mercz Shell Programming and Scripting 3 09-12-2002 10:18 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 08-15-2007
harris2107 harris2107 is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 8
AWK to extract information

Hi all,
I am working on a shell script to extract information from a file that has output from Oracle sqlplus. The problem is that the output of a single line is spread across multiple lines and i do not know as how to extract the particular filed at ones,which spans multiple lines. Following is what the file looks like from which i am trying to extract information.

DB1 Jack_ Harris_
Anderson Godwin

DB2 Rich Rick
DB3 Rice Paul

DB4 Paul_ Darren_
Keith Gough


As you can see from the file above, the output is skewed. In the first line the second column has name Jack_Anderson, which is divided in to two lines and there is a blank line between row1 and row 2. My question is how can i extract the individual fields. For eg: the AWK $2 on first line should give me Jack_Anderson (but it only gives Jack_) and $NR==2 is a blank line, how can i eliminate this blank line in the search? I am using AWK to extract the required fields, can anyone shed light on this. I am writing this in KORN shell.

Thanks,
Harris
 

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