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


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    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-21-2012
Registered User
 
Join Date: Dec 2010
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Get Column Data

Hi

I have a file which contains customer data...

Quote:

200000000000000475559xxxxxxxxxxxxCARDCX10 GBMRS. xxx xxxxxx xxxx xxxxxxx & CO LTD xxx xxxxxx ROAD ^I COLCHESTER ESSEX^I xxx xxx xxxx.xxxxx@GOOGLEMAIL.COM 0000000000000912906R0000000000000000000000000000 07509207499
I need to be able to strip out everything from the file so I am only left with the order number (0000000000000912906R)

The lenght of the columns can vary depending on the name, address etc but it appears that the order number is the second from last column.

Any help would be greatly appreciated.
Sponsored Links
    #2  
Old 06-21-2012
alister alister is offline Forum Advisor  
Registered User
 
Join Date: Dec 2009
Posts: 2,608
Thanks: 123
Thanked 719 Times in 602 Posts
In AWK you can refer to the next to last field using $(NF-1) .

Regards,
Alister
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Replace column that matches specific pattern, with column data from another file prashali Shell Programming and Scripting 7 05-15-2012 04:17 PM
Need to extract data from Column having variable length column ns64110 Shell Programming and Scripting 6 01-30-2012 08:19 AM
row to column and position data in to fixed column width baluchen Shell Programming and Scripting 4 03-15-2010 06:46 AM
Split Data in one column into 2 column in Excel using DOS or VBScript dashing201 Windows & DOS: Issues & Discussions 3 03-12-2010 05:04 AM
Extract data based on match against one column data from a long list data patrick87 Shell Programming and Scripting 12 11-17-2009 03:27 AM



All times are GMT -4. The time now is 04:59 AM.