The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
compare fields in a file with duplicate records rleal Shell Programming and Scripting 1 01-29-2009 02:55 AM
AWK ??-print for fields within records in a file hyennah UNIX for Dummies Questions & Answers 8 11-17-2008 05:03 PM
Extracting records with unique fields from a fixed width txt file sitney Shell Programming and Scripting 8 02-10-2008 03:18 AM
Awk Compare Files w/Multiline Records RacerX Shell Programming and Scripting 4 12-21-2007 06:05 AM
cut specific records from a file jxh461 Shell Programming and Scripting 2 02-23-2007 02:22 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 04-12-2009
sunayana3112 sunayana3112 is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 1
Cut specific fields from a file containing multiline records

Hi,
I am looking for a method to get column13 to column 50 data from the 1st line of a multiline reord. The records are stored in a large file and are separated by newline. sample format is

(data in red is to be extracted)

<header>

A001dfhskhfkdsh hajfhksdhfjh shdfhsdfhkjldsfhslkjlshdfsdlfhsd;lh
A002skdjfkjsdkfj kjafjdsljfpok;fjdskf;kldsjfposifpsjdf
A003jlskjfslkfjsljf ;dfs;ksjg
A004sdfhskjlfhlshf jhsfhskjldhfjs

A001dfhskhfkdsh hajfhksdhfjh shdfhsdfhkjldsfhslkjlshdfsdlfhsd;lh
A002skdjfkjsdkfj kjafjdsljfpok;fjdskf;kldsjfposifpsjdf
A003jlskjfslkfjsljf ;dfs;ksjg
A004sdfhskjlfhlshf jhsfhskjldhfjs
.....

<trailer>
  #2 (permalink)  
Old 04-12-2009
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,915
I don't understand the "column13-50" part but given your example this should work:

[use gawk, nawk or /usr/xpg4/bin/awk on Solaris]

Code:
awk '/^A[0-9]/{print substr($0,30,15)}' RS= infile

  #3 (permalink)  
Old 04-12-2009
krabu krabu is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 44
grep ^A001 | cut f15-50
  #4 (permalink)  
Old 04-14-2009
atl@mav atl@mav is offline
Registered User
  
 

Join Date: Mar 2009
Location: india
Posts: 8
cat filename | grep hajfhksdhfjh | cut -d ' ' | cut -f15-50
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 01:13 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