Search last column in a row

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
darioit
Posts: 230
Joined: 02 Aug 2010 05:25

Search last column in a row

#1 Post by darioit » 13 Jan 2011 02:34

Hello everybody,

how can I get the last column in a raw in a variable record length row?
Example

1237894b2376q2786ho8
21374y723dno
1237d8923717234 85710d5d1n

result
8
o
n

Regards
Dario

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Search last column in a row

#2 Post by !k » 13 Jan 2011 04:21

echo %var:~-1%
Read set/? for details

darioit
Posts: 230
Joined: 02 Aug 2010 05:25

Re: Search last column in a row

#3 Post by darioit » 13 Jan 2011 04:48

Great many Thanks

ghostmachine4
Posts: 319
Joined: 12 May 2006 01:13

Re: Search last column in a row

#4 Post by ghostmachine4 » 13 Jan 2011 18:25

you can use gawk

Code: Select all

gawk -vFS= "{print $(NF)}" file

Post Reply