On Wed, Mar 4, 2020 at 5:36 PM ‘Chad Baker’ via BBEdit Talk
<bbedit@googlegroups.com> wrote:

> The file opens fine without the ¿ gremlins in BBEdit without any intervention 
> on my part. And I
> can search it fine in BBEdit. What Console does differently , that I like, is 
> that when I search
> it will filter the file so that it only shows log lines that have a matching 
> word, and hides the
> rest. So when I search “error” it will hide 10,000 lines of irrelevant log 
> content and just show
> me the 5 lines of errors. If BBEdit has a mode where it can hide lines that 
> don’t contain a match,
> then that would work too. I could dump Console and just use BBE for my log 
> analysis tool

I don’t know if BBEdit has such a mode, but there’s always `grep`
which will just show matching lines.

     fgrep -i error input.log

You could used that on the command line or as a text filter in BBEdit,
I suppose.

> If I follow your suggestion and use Reopen Using Encoding Unicode (UTF-16, No 
> BOM) it looks fine in
> BBEdit, but it doesn’t actually change the file so Console will search it 
> correctly. For that, I
> still have to do the steps I mentioned and actually do a destructive edit 
> that removes the ¿’s
> then Save.

Well, at the risk of getting banned from the list ;-)
I’m going to offer another non-BBEdit solution.

I don't have a UTF-16 file handy to test, but it should work something
like this:

     iconv --from-code=UTF-16 --to-code=UTF-16LE input.log > input-16LE.log

That will save the log to a new file which can be opened in BBEdit or elsewhere.

(There’s also the `-c` option, which means “When this option is given,
characters that cannot be converted are silently discarded, instead of
leading to a conversion error.”)

If you want to combine those two commands, you could try this:

     iconv --from-code=UTF-16 --to-code=UTF-16LE input.log | fgrep -i error

That convert the file and pipe the resulting text to `fgrep` which
will then filter out everything except the lines which contain the
word 'error'

Tj

-- 
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: <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 bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/CADjGqHsFf%2BzLSLuQxaxxn5Y2AjeHiNM9Qj9ECwbRads3X2W3KA%40mail.gmail.com.

Reply via email to