On 05/07/2021, at 17:10, @lbutlr <[email protected] <mailto:[email protected]>> 
wrote:
> On 07 May 2021, at 05:32, Christopher Stone <[email protected] 
> <mailto:[email protected]>> 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 "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/D8354D3D-7404-4D83-A23B-4F2168447208%40gmail.com.

Reply via email to