Having problem with spliting record

Hi all,

My problem is i have to remove the “~” value from the last end of the
record, actually first i will read from the file, while reading the file
i have remove this “~”

1)LINEDIA0000050000005705700697RCSHEPLER’S EXCLU100SHEPLER’S
EXCLUSIVE6042142403SHEPLERS COGNAC HORNBACK CAIMAN
TAIL200707192007071902724178914197070
A
*******************50384~

2)LINEDIA0000050000005705700697RCSHEPLER’S EXCLU100SHEPLER’S
EXCLUSIVE6042142403SHEPLERS COGNAC HORNBACK CAIMAN
TAIL200707192007071902724178711291110
A
*******************50544~

3)LINEDIA0000050000005705700697RCSHEPLER’S EXCLU100SHEPLER’S
EXCLUSIVE6042142403SHEPLERS COGNAC HORNBACK CAIMAN
TAIL200707192007071902764556826704145
A
*******************50684~

At th 3 line end , i want to remove the "~", but i don't which

command to use it. my coding is

f = File.open(test,“r”)
@aa=f.read()
@[email protected]("~")
@a.each do |v|
@h=v.split("*")
end

Actually why i want to remove the last record means, when i am viewing
in array , i will get one more extra empty record, otherwise please let
me know, how to avoid the extra record. thanks :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs