Spool issue in unix

Hi Friends,

I am trying to spool the data from Teradata. The rpoblem which i am facing is , the coulmn data is appended with ".(dot)" for some coulmns. Please find the below data :

data i want in file :

1|BANG|KINR|3456
2|KIBNJ|UIE|6347
3|JEEM|Y34E|3874

data which is spooling in to the file :

 
1|BANG|KINR|3456.
2|KIBNJ|UIE.|6347
3.|JEEM|Y34E|3874
 

Please Help .. i tried trim option on the columns but no hope. :frowning:

How are you spooling the data into File... Do you want to remove the "." in the every occurence of the file...

---------- Post updated at 01:27 AM ---------- Previous update was at 01:21 AM ----------

You are excepting this one

 sed -e 's/[.]//g' test.txt 

Hi Bmk, Thanks for the reply. I would not say that i should remove all the occurence of . in a file. But i need to remove all the "." from the end of each column value .

For example i may get the value like

1234.5678

in the above case i should not remove the ".".

I should remove only the "." only at the end of the each coulumn value

Sample data :

1|HJKDEH|783.3748.|ewhjh.
2.|hjhDKJ.|1234.567|HEUY

I should remove "." from the each coulumn value delimited by "|"

Plz help ...Thanks in advance.

perl -pe 's/\.(?=[|\s])//g' test.txt
1 Like

You are excepting this one...

tr -d '.' < test.txt 
1 Like

@bala : Thanks for the reply :slight_smile: Can you please explain the above code, it will be more helpful to me as i am new to Shell. :slight_smile:

perl -pe '   => The perl language; Execute perl code and print all statements by default
s/           => Substitute
\.(?=[|\s])  => dot that is followed by either a pipe or a whitespace character (' ', '\t', '\n')
//           => with nothing
g            => and do this globally
' test.txt   => File on which perl has to operate
1 Like