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 11-18-2007
HAA HAA is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 24
split line when found newline

Hi ,

I have below problem and needs your advice,

i have a file a.txt as below

12|romario|ronaldo|robert
23|aaa|bbb|haaa
000000002

There is no issues when i open this file in window,it will sows as it is.

in Unix:

i want the last record into seperate file.

So i used
$ tail -1 a.txt > b.txt

Output shows(b.txt) that
23|aaa|bbb|haaa
000000002

There is no carriage return?

how to split these line into 2 seperate lines when i suing Shell scripts.

Thanks and Regards,
Hari