![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| remove blank lines in *.srt file :) | hungbp | UNIX for Dummies Questions & Answers | 10 | 02-16-2008 08:40 AM |
| How to get last non-blank line? | tqlam | Shell Programming and Scripting | 6 | 01-17-2008 07:13 PM |
| To remove Continous blank spaces from a file in UNIX | arunkumar_mca | UNIX for Dummies Questions & Answers | 1 | 12-08-2006 01:10 AM |
| remove blank spaces in a string | spandu | Shell Programming and Scripting | 2 | 03-02-2006 02:08 AM |
| Remove blank lines | osymad | UNIX for Dummies Questions & Answers | 4 | 08-27-2005 06:41 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Mac line endings are Carriage Returns, so just converting CR to LF should make the file Unix-friendly.
Code:
tr '\r' '\n' <oldfile >newfile |
|
||||
|
To remove DOS-style line breaks:
Code:
sed '/^M$//' oldfile > newfile To remove lines which contain any number of whitespace (Tabs and or blanks): Code:
sed '/^[<tab><blank>]*$/d' oldfile > newfile Finally, to find out which unprintable character is bothering you: open the file in vi, enter command mode (press ":") and enter "set list". You will see all the unprintable characters as control codes now (tab characters are represented by "^I" for instance, etc.). Only a blank is now printed as blank char. Enter command mode again and use "set nolist" to switch that off again. I hope this helps. bakunin |
![]() |
| Bookmarks |
| Tags |
| line endings, macintosh, text conversion mac2unix |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|