Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
google site



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 !!

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-07-2010
Registered User
 

Join Date: Sep 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Search flat file in specific byte

I am on AIX Unix. I want to read a flat file for a string in a certain byte. I want to find the value: 943034 in column 56; and write out just those records to another file. Also, could I get the line/record number of where it was found in the input file?

Thank you,
sboxtops
Sponsored Links
  #2  
Old 01-07-2010
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 6,729
Thanks: 0
Thanked 53 Times in 50 Posts

Code:
awk ' substr($0,56,6)=="943034" {print FNR ":", $0} ' inputfile

Sponsored Links
Closed Thread

Bookmarks

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need specific byte positions of a file rmv Shell Programming and Scripting 6 10-13-2009 06:31 AM
`find`, pulling 1st field from ASCII flat file as search/-name? Gecko12332 Shell Programming and Scripting 2 10-06-2009 04:34 PM
Read Write byte range/chunk of data from specific location in file Kbenipel Shell Programming and Scripting 1 05-22-2009 04:56 PM
Search flat file and return 3 fields da2357 Shell Programming and Scripting 7 11-18-2008 10:01 PM
remove specific lines from flat file using perl meghana Shell Programming and Scripting 12 02-12-2008 08:50 PM



All times are GMT -4. The time now is 07:35 AM.