Computing.Net > Forums > Unix > cut data backwards

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

cut data backwards

Reply to Message Icon

Name: nimi
Date: July 18, 2007 at 02:26:41 Pacific
OS: NA
CPU/Ram: NA
Product: NA
Comment:

I use the following to get the value after the 5th underscore which is 4
BSC403_JAIN03|3410_PantaiAceh_PCEHM1_4_97|

BSC_ID=`echo $DATA | cut -f5 -d"_"`


How do I read the same row but from backwards?
I want the first value after the last underscore which is again 4.
The reason is some of the record formats are not consistent.


Nimi



Sponsored Link
Ads by Google

Response Number 1
Name: James Boothe
Date: July 18, 2007 at 07:01:33 Pacific
Reply:

echo $DATA | awk -F_ '{print $(NF-1)}'


0
Reply to Message Icon

Related Posts

See More


Copy print job Sort and seperate data fr...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: cut data backwards

sort data www.computing.net/answers/unix/sort-data/7134.html

cut and paste (urgent) www.computing.net/answers/unix/cut-and-paste-urgent/6965.html

sum or multiply data in files www.computing.net/answers/unix/sum-or-multiply-data-in-files/3797.html