The UNIX and Linux Forums  


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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
if match found go to a particular line in perl user_prady Shell Programming and Scripting 17 03-31-2008 04:00 PM
How to convert ^M appearing at end of line to unix newline? videsh77 UNIX for Dummies Questions & Answers 21 09-01-2007 08:21 AM
Split a huge line into multiple 120 characters lines with sed? jerome_1664 Shell Programming and Scripting 2 08-17-2006 01:03 PM
sed help split line Raom UNIX for Advanced & Expert Users 5 01-30-2006 01:39 AM
append newline to files with incomplete last line ziyi UNIX for Dummies Questions & Answers 1 04-14-2004 10:00 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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
  #2 (permalink)  
Old 11-18-2007
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Do a 'cat -vet <file>' in unix to take a look at exactly what the file looks like. That'll give you any unprintable characters, the carriage returns and line feeds etc.

Let's start with that and decide how to sort it out after that.
  #3 (permalink)  
Old 11-19-2007
HAA HAA is offline
Registered User
  
 

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

Hi,

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

There is $ simple in line 1,
There is no carriage return at last line.

Can you advise please.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:03 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0