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
c program to extract text between two delimiters from some text file kukretiabhi13 High Level Programming 7 12-03-2008 06:29 PM
how to extract columns from a text file ihot Shell Programming and Scripting 16 05-05-2008 11:33 PM
How to extract text from xml file chrisf Shell Programming and Scripting 3 09-01-2007 02:25 PM
Extract data from file getdpg Shell Programming and Scripting 20 08-03-2006 03:54 AM
extract data from file apalex Shell Programming and Scripting 2 04-27-2002 01:24 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 07-19-2005
negixx negixx is offline
Registered User
  
 

Join Date: Jun 2005
Location: St. Louis, MO
Posts: 32
How to extract data from a text file

Hello All,

Is there an easy way to extract data from a text file? The text file is actually a dump of a 2 page report with 6 columns and 122 lines. Example is

Report Tile

Type Product 1 Product 2 Product 3 Product 4 Product 5

Budget

Current
MTD
YTD.

Payments

Second Page of Report :
Report Tile

Type Product 6 Product 7 Product 8 Product 9 Grand Total

Budget

Current
MTD
YTD.

Payments



Say we only want to get the amount in :
Current - Product8, Product 9 and grand total.
MTD - Product8, product9 and Grand total
YTD - product8, product9 and Grand Total

Checking the text file, these are in rows 81, 82 and 83.

Thanks!


negixx
  #2 (permalink)  
Old 07-19-2005
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,407
Maybe try something like...
Code:
awk 'NR>=81 && NR<=83 {print $4, $5, $6}' file1
Closed Thread

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 10: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