How to concatenate/merge/combine text files with BBEdit (version 10.5.11)

4,669 views
Skip to first unread message

Jason Finley

unread,
Jul 9, 2014, 7:56:02 PM7/9/14
to bbe...@googlegroups.com
I'm documenting this here because it's not intuitive and I could not find good current instructions elsewhere.

BBEdit version 10.5.11
July 9th, 02014CE

How to concatenate/merge/combine text files into one text file:
--Create a new blank document.
--Edit --> Insert --> File Contents...
--Select ALL the files you want to concatenate/merge/combine together.
--Save the new document.

Note: past versions of BBEdit apparently had different ways of doing this, and future versions may also have different ways.  Good luck!

Patrick Woolsey

unread,
Jul 9, 2014, 8:56:02 PM7/9/14
to bbe...@googlegroups.com
On 7/9/14 at 7:56 PM, jasonrich...@gmail.com (Jason
Finley) wrote:

>I'm documenting this here because it's not intuitive and I
>could not find good current instructions elsewhere.

>How to concatenate/merge/combine text files into one text file:
>[...steps elided...]


For further reference, here is the relevant description from
Chapter 4 of BBEdit's PDF manual (choose Help -> User Manual):
====

Chapter 4 : Editing Text with BBEdit

[...]

The Insert Submenu

[...]

Inserting File Contents

The File Contents command inserts the contents of one or more
files into the document you are editing. When you use this
command, BBEdit displays an Open sheet in which you can choose
the files to insert. To select more than one file hold down the
Shift key or [ Command ]* key as you click the files. BBEdit
then inserts the contents of the selected files at the insertion
point or replaces the selected text. If you select more than one
file, the files will be inserted in alphabetical order,
according to file name.

[Tip: You can also drag a file's icon from the Finder into a BBEdit
editing window to insert the contents of that file. ]

====
[*: The present manual incorrectly says "Control", so we'll
correct that in the next turn.]


>Note: past versions of BBEdit apparently had different ways of
>doing this, and future versions may also have different ways. [...]

BBEdit has included this command for quite a long time (since
7.x, for anyone who's curious :) and will likely continue to. :-)


Regards,

Patrick Woolsey
==
Bare Bones Software, Inc. <http://www.barebones.com/>

John Delacour

unread,
Jul 10, 2014, 8:23:29 AM7/10/14
to bbe...@googlegroups.com

On 10 Jul 2014, at 00:56, Jason Finley <jasonrich...@gmail.com> wrote:

> How to concatenate/merge/combine text files into one text file:
> --Create a new blank document.
> --Edit --> Insert --> File Contents...
> --Select ALL the files you want to concatenate/merge/combine together.
> --Save the new document.

This can be done very simply in the Terminal or using an AppleScript script to identify the documents you want to concatenate and then using do shell script "cat...


cd some_folder;
cat a.txt b.txt c.txt > all.txt;
open -a bbedit all.txt


JD

Rich Siegel

unread,
Jul 10, 2014, 10:16:48 AM7/10/14
to bbe...@googlegroups.com
On Thursday, July 10, 2014, John Delacour <J...@BD8.com> wrote:

>This can be done very simply in the Terminal or using an
>AppleScript script to identify the documents you want to
>concatenate and then using do shell script "cat...
>
>
>cd some_folder;
>cat a.txt b.txt c.txt > all.txt;
>open -a bbedit all.txt

Nobody uses `open -a` anymore. :-) This can be done even more
simply with the `bbedit` command-line tool or from inside of a
BBEdit shell worksheet, if you can't resist the compulsion to
use the command line for something for which a serviceable GUI exists:

cd /path/to/whatever/folder
cat a.txt b.txt c.txt | bbedit

(Or you could use shell wildcards for even more brevity, which
we all know is the soul of wit.)

R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <http://www.barebones.com/>

Someday I'll look back on all this and laugh... until they
sedate me.

Sam H.

unread,
Jul 11, 2014, 8:57:24 AM7/11/14
to bbe...@googlegroups.com
On 2014-07-10, 8:23 AM, John Delacour wrote:
> cd some_folder;
> cat a.txt b.txt c.txt > all.txt;
> open -a bbedit all.txt

Or even (if you have the BBEdit command line tools installed):

cd some_folder
cat a.txt b.txt c.txt | bbedit
Reply all
Reply to author
Forward
0 new messages