The UNIX and Linux Forums  


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
How to replace any char with newline char. mightysam Shell Programming and Scripting 5 09-18-2008 09:15 PM
extraction of last but one char hidnana Shell Programming and Scripting 5 02-14-2008 08:22 AM
SED scipt help - line extraction thuston22 Shell Programming and Scripting 10 03-24-2006 06:11 PM
Help with tar extraction! manthasirisha Shell Programming and Scripting 4 03-17-2006 07:17 AM

 
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 02-14-2008
hidnana hidnana is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 14
extraction of last but one char in a line

I need to extract the character before the last "|" in the following lines, which are 'N' and 'U'. The last "|" shouldn't be extracted. Also the no.s of "|" may vary in a line, but I need only the character before the last one.

TT-CAP-N241485-0005241485|ADMINISTRATOR|INC_ORGANISATION_NAME|SUPERIOR_TITLE_1|REV|FIRST_NAME_1|MIDDLE_NAME_1|SURNA ME_FIELD|INC ADDRESSS 1|INC ADDRESSS 2|INC ADDRESSS 3|INC ADDRESSS 4|INC ADDRESSS 5|INC ADDRESSS 6|IN123EC|MALTA|Y||M||Y|LIFEASSURED 2|Y|N||||||||||||||||||||||||Y||Y||||||||||||PRU|A||289832|||FCBGFBF|Y|Y|1|DC|1|1|3|Y|O||20300601||| CAP|5649369|VVUMU7SMT0|HCBCBFDJF|N|Y|N|Y|Y|N|Y|Y|N|3||6|C|20051205|555555555|||||20070604|4|15||C|0| 9|4527|0||20071109|4|C|982062|23569837|36657407|9096||20071205|1|N|

TT-CAP-5241492-0005241492|ADMINISTRATOR1|INC_ORGANISATION_NAME|SUPERIOR_TITLE_1|MS|FIRST_NAME_1|MIDDLE_NAME_1|SURNA ME_FIELD|INC ADDRESSS 1|INC ADDRESSS 2|INC ADDRESSS 3|INC ADDRESSS 4|INC ADDRESSS 5|INC ADDRESSS 6|IN123EC||N||F||N|LIFE ASSURED 1|Y|N||||||||||||||||||||||||Y||Y||||||||||||PRU|BFF||200006|||EB|Y|Y|3|DC|2|1|3|Y|O||20301207|||CAP |5649376|ZLBFQDGVGIOIJDHKNDK|F|N|Y|Y|N|Y|N|N|Y|N|4||7|C|20051205|555555555|||||20070604|2|1600770||B |281215|66|124002|923545||20060405|1|C|1446100|92811|64148521|5||20071205|1|U|

I'm not able to achieve it by cut command. How can it be done ?
 

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 04:43 PM.


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