The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-24-2008
dbsurf dbsurf is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 23
need to find last character in each line in all files

Hi,

I need to read each line in all files .If last character in each line is not ;(semicolon) then i need to append next line also.Here each line may consists of multiple semicolons(.but i need to read only last character.I need to achieve this using shell script.And i need to remove tht last semicolon also.I need to achieve this in all files in a directory and i need to redirect modified files to the same directory.
How to achieve this?

For example my file consists of
asdfgh;adffg;afdfg;
adfsffvfgggg;
aedfdsfs
fsff;

Here i need output as
asdfgh;adffg;afdfg
adfsffvfgggg
aedfdsfs fsff

How to achieve this?