Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: sed/vi how to concatenate all non-empty lines?
- To: tlug@example.com
- Subject: Re: sed/vi how to concatenate all non-empty lines?
- From: Shimpei Yamashita <shimpei@example.com>
- Date: Wed, 25 Jul 2001 20:42:19 +0900
- Content-Disposition: inline
- Content-Type: text/plain; charset=us-ascii
- Delivered-To: tlug@example.com
- In-Reply-To: <F165mNN79xavjrRZ1Ub00005c14@example.com>
- List-Help: <mailto:tlug-request@example.comsubject=help>
- List-Post: <mailto:tlug@example.com>
- List-Subscribe: <mailto:tlug-request@example.comsubject=subscribe>
- List-Unsubscribe: <mailto:tlug-request@example.comsubject=unsubscribe>
- Old-Return-Path: <shimpei@example.com>
- Reply-To: tlug@example.com
- Resent-From: tlug@example.com
- Resent-Message-ID: <GB2WDB.A.kOH.DMrX7@example.com>
- Resent-Sender: tlug-request@example.com
- User-Agent: Mutt/1.3.18i-ja0
On Wed, Jul 25, 2001 at 08:28:04AM +0000, Jean-Christian Imbeault wrote: > Update, > > col and the script you provided work fined, except that it removed all blank > lines :) I was hoping to keep the blank lines as they separated the > paragraphs from each other . . . I'm going to cheat and use a short perl script. :-p #! /usr/bin/perl -w $/ = undef; # slurp in the entire file using <STDIN> while (<STDIN>) { s/([^\n])\n([^\n])/$1 $2/g; # convert non-consecutive end-of-lines # to space print; } Save this script as, say, concatLines, chmod it to 755, and run it like this: col originalfile.txt | concatLines > output.txt -- Shimpei Yamashita http://www.shimpei.org/
- References:
- RE: sed/vi how to concatenate all non-empty lines?
- From: "Jean-Christian Imbeault" <jean_christian@example.com>
Home | Main Index | Thread Index
- Prev by Date: Re: perl question
- Next by Date: Re: sed/vi how to concatenate all non-empty lines?
- Prev by thread: Re: sed/vi how to concatenate all non-empty lines?
- Next by thread: Re: sed/vi how to concatenate all non-empty lines?
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links