Re: Need help accessing multiple files' content at the same time

2021-05-09 Thread Greg Raven
Great responses, but depending on the command-line processing that needs to 
be done, my approach would be to set up these files in a project. The files 
themselves would go into the Includes folder, and then the include commands 
would go into a single file in the build folder. This way, the contents of 
the concatenated file could be updated instantly after changing any of the 
source / include files.

It would also allow you to pick and chose which of the files in the include 
folder to concatenate.

Should any of the command-line processes throw off the arrangement of the 
concatenated file (via a sort, for example), I would make a copy of just 
the bbinclude commands and save it to the Scratchpad, from whence it could 
easily be retrieved for restoring the single file for re-concatenation.

On Friday, April 30, 2021 at 5:20:27 AM UTC-7 Howard wrote:

> I have a folder on my Mac with multiple text files. I need to run the same 
> Unix command line, which I have, on all of them. I would like to do all of 
> them at the same time.
>
> Can I do either of the following using BBEdit (vers. 13.5.6)?
>
> 1. Combine all the files into one text file.
> 2. From BBEdit, access all the files in their folder at the same time?
>
> If either can be done, I would appreciate directions on doing it.
>
> Thanks,
> Howard
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/25c3b3af-22fe-45bd-a394-f21dcfb7c175n%40googlegroups.com.


Re: Need help accessing multiple files' content at the same time

2021-05-08 Thread Christopher Stone
On 05/07/2021, at 17:10, @lbutlr mailto:krem...@kreme.com>> 
wrote:
> On 07 May 2021, at 05:32, Christopher Stone  > wrote:
>> # Find files, concatenate their contents, send result to BBEdit.
>> find -E . -type f \( ! -name ".*" \) -exec sed -n '1,$p' {} \; | bbedit
> 
> OK, two questions.
> 
>  1) why -E?
>  2) '1,$p'?
> 
> Where/what is $p?


Hey Lewis,

Well, -E isn't really necessary in this use-case.  I have it in my template for 
find, because I often use a regular expression and always want to use the 
Extended regular expression set.

> sed -n '1,$p'

This is just `sed` printing from line 1 through the last line of the given file.

And actually that can be reduced to just p for print:

sed -n 'p'

So this works perfectly well:

find -E . -type f \( ! -name ".*" \) -exec sed -n 'p' {} \; | bbedit

I was going to use `cat` for this task, but `sed` will add an ending line break 
if there isn't one already in the printed file and `cat` won't.

Sed:

file01contents
file02contents
file02contents

Cat:

file01contentsfile02contentsfile02contents


--
Take Care,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/D8354D3D-7404-4D83-A23B-4F2168447208%40gmail.com.


Re: Need help accessing multiple files' content at the same time

2021-05-07 Thread @lbutlr
On 07 May 2021, at 05:32, Christopher Stone  wrote:
> # Find files, concatenate their contents, send result to BBEdit.
> find -E . -type f \( ! -name ".*" \) -exec sed -n '1,$p' {} \; | bbedit

OK, two questions.

  1) why -E?
  2) '1,$p'?

Where/what is $p?

-- 
When men talk to their friends, they insult each other. They don't
really mean it. When women talk to their friends, they compliment
each other. They don't really mean it.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/D4A59BDA-CC84-4A15-9B5E-C6834B87286F%40kreme.com.


Re: Need help accessing multiple files' content at the same time

2021-05-07 Thread Christopher Stone
On 05/06/2021, at 10:06, Howard mailto:leadwithlo...@gmail.com>> wrote:
> Patrick, your way of concatenating individual files works well.
> 
> I have a folder that contains both folders whose contents I would like to 
> include in the concatenation as well as separate individual files. Is there a 
> way to do that in BBEdit?


Hey Howard,

If you're going to do this regularly you might want to systematize the process.

Place the following script in:

~/Library/Application Support/BBEdit/Scripts/


#!/usr/bin/env bash
# -
# Auth: Christopher Stone
# dCre: 2021/05/07 06:07
# dMod: 2021/05/07 06:07 
# Task: Recursively Concatenate Files in the Front Finder Window.
# Tags: @ccstone, @Shell, @Script, @Concatenate, @Files, @Finder, @BBEdit
# -

# Acquire the path to the Front Finder Window. (Finder Insertion Location.)
read -r -d '' asCmdStr <<'EOF'
   tell application "Finder"
  set targetFolder to insertion location as alias
  return POSIX path of targetFolder
   end tell
EOF
targetFolderPath=$(osascript -e "$asCmdStr")

# Change the working directory to the Finder Insertion Location.
cd "$targetFolderPath"

# Find files, concatenate their contents, send result to BBEdit.
find -E . -type f \( ! -name ".*" \) -exec sed -n '1,$p' {} \; | bbedit


Give it a memorable name.

If desired give it a keyboard shortcut in BBEdit's Menus & Shortcuts 
Preferences.


REQUIREMENTS:

BBEdit's command line tools must be installed.



USAGE:

1) Open the desired target directory in the Finder, so its window is FRONTMOST.

2) Run the script from BBEdit's Script menu or via a keyboard shortcut.


RESULT:

A new window will be opened in BBEdit containing the concatenated contents of 
every file in the target directory (recursive).


--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/6C639B20-5E85-4D55-AF42-0A2B82EB1B21%40gmail.com.


Re: Need help accessing multiple files' content at the same time

2021-05-06 Thread Howard

Patrick, thanks for your help.
On Thursday, 6 May 2021 at 12:23:08 pm UTC-4 Patrick Woolsey wrote:

> OK, thanks and manual expansion & selection should suffice in 
> this case, though probably not the general. :-)
>
> (PS: I suggest you switch the selection dialog to "List" mode 
> rather than "Icon" or "Columns".)
>
>
> Regards
>
> Patrick Woolsey
> ==
> Bare Bones Software, Inc. 
>
>
>
>
> On 5/6/21 at 12:06 PM, leadwi...@gmail.com (Howard) wrote:
>
> >It currently has 22 items, 20 of which are split between two folders.
> >
> >On Thursday, 6 May 2021 at 11:43:24 am UTC-4 Patrick Woolsey wrote:
> >
> >>On 5/6/21 at 11:06 AM, leadwi...@gmail.com (Howard) wrote:
> >>
> >>>Patrick, your way of catenating individual files works well.
> >>>
> >>>I have a folder that contains both folders whose contents I 
> >>>would like to include in the catenation as well as separate 
> >>>individual files. Is there a way to do that in BBEdit?
> >>>
> >>
> >>I'm happy that was helpful and to your current question:
> >>
> >>Since the Insert -> File Contents command does not presently 
> >>support selecting folders directly, you would instead need to 
> >>manually expand all the desired folders (and subfolders if 
> >>relevant) and individually select their contents.
> >>
> >> From curiosity :-) may I ask how approximately how many items 
> >>the desired set of folders & files contains?
> >>
> >>
> >>Regards
> >>
> >>Patrick Woolsey
> >>==
> >>Bare Bones Software, Inc. 
> >>
> >>
> >
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/a81dc275-9bbc-45a9-a457-48c9315add44n%40googlegroups.com.


Re: Need help accessing multiple files' content at the same time

2021-05-06 Thread Patrick Woolsey
OK, thanks and manual expansion & selection should suffice in 
this case, though probably not the general. :-)


(PS: I suggest you switch the selection dialog to "List" mode 
rather than "Icon" or "Columns".)



Regards

 Patrick Woolsey
==
Bare Bones Software, Inc. 




On 5/6/21 at 12:06 PM, leadwithlo...@gmail.com (Howard) wrote:


It currently has 22 items, 20 of which are split between two folders.

On Thursday, 6 May 2021 at 11:43:24 am UTC-4 Patrick Woolsey wrote:


On 5/6/21 at 11:06 AM, leadwi...@gmail.com (Howard) wrote:


Patrick, your way of catenating individual files works well.

I have a folder that contains both folders whose contents I 
would like to include in the catenation as well as separate 
individual files. Is there a way to do that in BBEdit?




I'm happy that was helpful and to your current question:

Since the Insert -> File Contents command does not presently 
support selecting folders directly, you would instead need to 
manually expand all the desired folders (and subfolders if 
relevant) and individually select their contents.


From curiosity :-) may I ask how approximately how many items 
the desired set of folders & files contains?



Regards

Patrick Woolsey
==
Bare Bones Software, Inc. 






--
This is the BBEdit Talk public discussion group. If you have a feature request or need 
technical support, please email "supp...@barebones.com" rather than posting here. 
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/r480Ps-10146i-853FBF9356F74DABAED129625C822C33%40Cylinder.local.


Re: Need help accessing multiple files' content at the same time

2021-05-06 Thread Howard
It currently has 22 items, 20 of which are split between two folders.

On Thursday, 6 May 2021 at 11:43:24 am UTC-4 Patrick Woolsey wrote:

> On 5/6/21 at 11:06 AM, leadwi...@gmail.com (Howard) wrote:
>
> >Patrick, your way of catenating individual files works well.
> >
> >I have a folder that contains both folders whose contents I 
> >would like to include in the catenation as well as separate 
> >individual files. Is there a way to do that in BBEdit?
> >
>
> I'm happy that was helpful and to your current question:
>
> Since the Insert -> File Contents command does not presently 
> support selecting folders directly, you would instead need to 
> manually expand all the desired folders (and subfolders if 
> relevant) and individually select their contents.
>
> From curiosity :-) may I ask how approximately how many items 
> the desired set of folders & files contains?
>
>
> Regards
>
> Patrick Woolsey
> ==
> Bare Bones Software, Inc. 
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/439d0257-a5cd-4b36-8422-9ccd43c53cf7n%40googlegroups.com.


Re: Need help accessing multiple files' content at the same time

2021-05-06 Thread Patrick Woolsey

On 5/6/21 at 11:06 AM, leadwithlo...@gmail.com (Howard) wrote:


Patrick, your way of catenating individual files works well.

I have a folder that contains both folders whose contents I 
would like to include in the catenation as well as separate 
individual files. Is there a way to do that in BBEdit?




I'm happy that was helpful and to your current question:

Since the Insert -> File Contents command does not presently 
support selecting folders directly, you would instead need to 
manually expand all the desired folders (and subfolders if 
relevant) and individually select their contents.


From curiosity :-) may I ask how approximately how many items 
the desired set of folders & files contains?



Regards

 Patrick Woolsey
==
Bare Bones Software, Inc. 

--
This is the BBEdit Talk public discussion group. If you have a feature request or need 
technical support, please email "supp...@barebones.com" rather than posting here. 
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/r480Ps-10146i-6B1653F0FB3843059C40C96183AE70B7%40Cylinder.local.


Re: Need help accessing multiple files' content at the same time

2021-05-06 Thread Howard
Patrick, your way of catenating individual files works well.

I have a folder that contains both folders whose contents I would like to 
include in the catenation as well as separate individual files. Is there a 
way to do that in BBEdit?

Howard

On Sunday, 2 May 2021 at 11:36:26 am UTC-4 Howard wrote:

> Thanks Patrick. By catenating the files, it was easy to produce the 
> results I needed.
>
> On Friday, 30 April 2021 at 10:05:27 am UTC-4 Patrick Woolsey wrote:
>
>> Per item 2. this sounds like a job for either the Text -> Apply Text 
>> Transform command or a _text factory_ with a suitable 'Run Unix Filter' 
>> action.
>>
>> Per item 1. you can catenate any selectable set of files into an existing 
>> document via the Edit -> Insert -> File Contents... command
>>
>>
>>
>> Regards,
>>
>> Patrick Woolsey
>> ==
>> Bare Bones Software, Inc. 
>>
>>
>>
>> > On Apr 30, 2021, at 08:20, Howard  wrote:
>> > 
>> > I have a folder on my Mac with multiple text files. I need to run the 
>> same Unix command line, which I have, on all of them. I would like to do 
>> all of them at the same time.
>> > 
>> > Can I do either of the following using BBEdit (vers. 13.5.6)?
>> > 
>> > 1. Combine all the files into one text file.
>> > 2. From BBEdit, access all the files in their folder at the same time?
>> > 
>> > If either can be done, I would appreciate directions on doing it.
>> > 
>> > Thanks,
>> > Howard
>>
>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/31ba582d-1347-4eca-a286-4deed346be30n%40googlegroups.com.


Re: Need help accessing multiple files' content at the same time

2021-05-02 Thread Howard
Thanks Patrick. By catenating the files, it was easy to produce the results 
I needed.

On Friday, 30 April 2021 at 10:05:27 am UTC-4 Patrick Woolsey wrote:

> Per item 2. this sounds like a job for either the Text -> Apply Text 
> Transform command or a _text factory_ with a suitable 'Run Unix Filter' 
> action.
>
> Per item 1. you can catenate any selectable set of files into an existing 
> document via the Edit -> Insert -> File Contents... command
>
>
>
> Regards,
>
> Patrick Woolsey
> ==
> Bare Bones Software, Inc. 
>
>
>
> > On Apr 30, 2021, at 08:20, Howard  wrote:
> > 
> > I have a folder on my Mac with multiple text files. I need to run the 
> same Unix command line, which I have, on all of them. I would like to do 
> all of them at the same time.
> > 
> > Can I do either of the following using BBEdit (vers. 13.5.6)?
> > 
> > 1. Combine all the files into one text file.
> > 2. From BBEdit, access all the files in their folder at the same time?
> > 
> > If either can be done, I would appreciate directions on doing it.
> > 
> > Thanks,
> > Howard
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/480d5aca-c47d-4046-b585-f9c9f61d60acn%40googlegroups.com.


Re: Need help accessing multiple files' content at the same time

2021-04-30 Thread face
hmm - in a shell like bash you would do something like
for FILENAME in ls * do
 unixcommandline $FILENAME ;
done

It can get messier, but if all the files (and only the files) are in a 
directory this would be simplest.


On Friday, April 30, 2021 at 7:05:27 AM UTC-7 Patrick Woolsey wrote:

> Per item 2. this sounds like a job for either the Text -> Apply Text 
> Transform command or a _text factory_ with a suitable 'Run Unix Filter' 
> action.
>
> Per item 1. you can catenate any selectable set of files into an existing 
> document via the Edit -> Insert -> File Contents... command
>
>
>
> Regards,
>
> Patrick Woolsey
> ==
> Bare Bones Software, Inc. 
>
>
>
> > On Apr 30, 2021, at 08:20, Howard  wrote:
> > 
> > I have a folder on my Mac with multiple text files. I need to run the 
> same Unix command line, which I have, on all of them. I would like to do 
> all of them at the same time.
> > 
> > Can I do either of the following using BBEdit (vers. 13.5.6)?
> > 
> > 1. Combine all the files into one text file.
> > 2. From BBEdit, access all the files in their folder at the same time?
> > 
> > If either can be done, I would appreciate directions on doing it.
> > 
> > Thanks,
> > Howard
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/3700f4c1-63bc-4fce-b961-92c97d03d373n%40googlegroups.com.


Re: Need help accessing multiple files' content at the same time

2021-04-30 Thread Patrick Woolsey
Per item 2. this sounds like a job for either the Text -> Apply Text Transform 
command or a _text factory_ with a suitable 'Run Unix Filter' action.

Per item 1. you can catenate any selectable set of files into an existing 
document via the Edit -> Insert -> File Contents... command



Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc. 



> On Apr 30, 2021, at 08:20, Howard  wrote:
> 
> I have a folder on my Mac with multiple text files. I need to run the same 
> Unix command line, which I have, on all of them. I would like to do all of 
> them at the same time.
> 
> Can I do either of the following using BBEdit (vers. 13.5.6)?
> 
> 1. Combine all the files into one text file.
> 2. From BBEdit, access all the files in their folder at the same time?
> 
> If either can be done, I would appreciate directions on doing it.
> 
> Thanks,
> Howard

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/E33A3492-920C-47A6-963A-456C00BE4327%40barebones.com.


Need help accessing multiple files' content at the same time

2021-04-30 Thread Howard
I have a folder on my Mac with multiple text files. I need to run the same 
Unix command line, which I have, on all of them. I would like to do all of 
them at the same time.

Can I do either of the following using BBEdit (vers. 13.5.6)?

1. Combine all the files into one text file.
2. From BBEdit, access all the files in their folder at the same time?

If either can be done, I would appreciate directions on doing it.

Thanks,
Howard

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/226e4b78-2c37-4c0e-9e00-4dd132d131a7n%40googlegroups.com.