[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: simple text formatting



On Mon, 2003-10-06 at 12:07, Mike Egglestone wrote:
> Hi,
> 
> I have a file in this format of words:
> 
> joe jill bill bob frank tom harry
> 
> and want to convert the file to this format:
> 
> joe
> jill
> bill
> bob
> frank
> tom
> harry
> 
> Is there an easy way to this? The file I have has hundreds of entries.

Then you should probably consider using sed, rather than building a huge
args list with `cat file`

Try
sed -ri 's/[ \t]+/\n/g' file

This will modify the existing file, replacing any spaces or tabs with
carriage returns. If you do not wish to modify the existing file,
exclude the "i" option and pipe the output to a new file.



-- 
 -------------------------------------------------------------------
| My problem lies in reconciling my gross habits with my net income.|
 -------------------------------------------------------------------

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: