Why doesn't `grep -v` invert the matching? [closed] - grep

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I'm trying to search for a certain url across many repos via ag -l --hidden <url>, but a large number of the results look like ERR: Error opening directory ./Library/Containers/com.apple.news: Operation not permitted. I want to exclude these.
So I was running ag -l --hidden <url> | grep -v Error but then all it does is ONLY match those lines, and excludes everything else! It's like it's ignoring the -v flag for inversion.
What am I missing here?

To quote Mark Setchell's comment above:
The error messages are likely on stderr and not filtered by your grep. You probably need 2>&1 after your ag command.
That is to say, while the normal output of ag is to stdout, which is what's piped to grep, the error messages are going to stderr, which is not piped.
By using 2>&1, stderr for the ag command is redirected to stdout, so grep filters it as well.

Related

Google Coral : hide kernel boot messages [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
How to hide kernel boot message on the Google Coral ?
# cat /etc/debian_version
10.0
but i can't find the grub file (i tried, like for debian, /etc/default/grub ... nothing) to edit and add "quiet" (like for a regular Ubuntu/Debian), then regenerate grub :(
embeded linux usually uses uboot instead of grub as it is too large. Specifics on how to customizing kernel should take more researches, however, you can add loglevel=0 to the kernel command line to eliminate some kernel messages.
Download boot.txt:
$ curl https://coral.googlesource.com/uboot-imx-debian/+/refs/heads/master/debian/boot.txt\?format\=TEXT | base64 --decode | tee boot.txt > /dev/null
Install mkimage:
$ sudo apt install u-boot-tools
Make your necessary changes in the cmdline="" line, for this example, we need to add "quiet loglevel=0":
cmdline=<preexsisting> + quiet loglevel=0
compile to boot.scr:
$ mkimage -A arm -T script -O linux -d boot.txt boot.scr
replace old boot image file
$ mv boot.scr > /boot
Reboot and the new kernel params should be loaded.
share edit delete flag

Installing "en_US" in RHEL container [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I'm testing an ansible role using molecule. The role install a corporate binary over which I've no insight, I'm just mean to ./binary --silent and that's it. Over RedHat.
It work for a RedHat 6.9 VM. But it doesn't work over the docker container registry.access.redhat.com/rhel6:6.9.
The error message says:
"Operating system bad language (en_US not found)".
What could be missing from the container that would be on the VM? Some localedef ...? I wasn't able to find a doc about this, but is there some RedHat description about the delta between their "minimal install from ISO" VMs and containers?
Thanks for any help
If you run locale -a on the Docker image you're using, you'll get the following output:
C
en_US.utf8
POSIX
Run the same command in your VM and compare output. If it contains line en_US (without utf-8 suffix), try adding the following lines dicrectly below FROM directive in your Dockerfile:
RUN localedef -v -c -i en_US -f UTF-8 en_US; exit 0
RUN sed -i 's/en_US.UTF-8/en_US/g' /etc/sysconfig/i18n && source /etc/sysconfig/i18n
This will generate locale en_US with encoding UTF-8 named en_US (without any suffix).

why the cygWin grep gives error? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am trying to recursively search for the below string in all my C# files. Why am I gettig this error? Took me a lontime to install CygWin and I have been using Unix forever, but this is not acting like Unix's grep. Noteworthy that I am using Cygwin for my WIndows7. Thanks
grep -R 'new IIntf' *.*
grep: *.*: No such file or directory
grep -R 'new IIntf' *.cs
grep: *.cs: No such file or directory
There may be no files matching *.* in the current directory. Perhaps you mean grep -R 'new IIntf' .

Batch - Is it possible to create a batch file thats check if a website / url redirect to another site [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Is it possible to create a batch file thats check if a website / url redirect to another site?
for example check if http://www.google.com/ redirect to http://www.google.com/randomsite.php/ and i would be great if it could do a status like:
www.google.dk/ Redirects to www.google.dk/randomsite.php/
for example with echo and some varible like:
echo %Google1% Redirects to %Google2%
And that would look like this
www.google.dk/ Redirects to www.google.dk/randomsite.php/
There are no built-in tools in Windows, but if you download a Windows compatible version of curl, you can use that to print the headers. This blog article seems a good place to start.
For example:
curl -sL http://www.stackoverflow.com --head | find "301" OR
curl -sL http://www.stackoverflow.com --head | find "302"
If found, the %ERRORLEVEL% variable will be greater than 0, so you can check that.
Under Linux, curl -I http://yoururl.com. You just need the first line, so start maybe with curl -I http://yoururl.com | head -n 1

pngcrush: uncrush on linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Apple's iOS SDK use a modified version of pngcrush for converting png files in iOS bundles.
Their version can also revert the changes (using the "-revert-iphone-optimizations" switch), but the original version can't.
Is there a tool that can be run on Linux and revert the iphone optimizations?
Thanks.
iphone-fixpng works in Linux. See this discussion explaining what it does. I'm linking to web.archive.org because the original is down.
You can choose to use one of this:
Install Hackintosh inside linux, with VirtualBox. install Xcode inside it, then do something like this
$ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -dir uncrushed -revert-iphone-optimizations -q *.png
This uses a modified pngcrush from apple to undo its optimizations. Guess this will work with all crushed pngs. See this for more accurated command xcrun
Download iPIN.py from this blog and execute as
$ python ipin.py
This will uncrush all files from actual directory and its subdirectories. Don't worry about call it twice, from my experience does not corrupt already uncrushed pngs. From here you will find that ipin.py does not deoptimize all apple pngs
It (ipin.py) cannot handle multiple IDAT chunks, does not work with Adam7 interlaced images, and does not fix pre-multiplied alpha.
Use an specific gnome binary tool. This needs a few low level steps:
$ git clone https://github.com/hadess/fixpng-thumbnailer.git
$ cd fixpng-thumbnailer
$ ./autogen.sh
$ make
$ sudo make install
After that, you have available a new command gnome-fixpng-thumbnailer which works like this
$ gnome-fixpng-thumbnailer [INPUT FILE] [OUTPUT FILE]
Take care with this command, because it corrupts pngs if is called twice on same png.
I use it this way:
$ for file in *.png; do echo " $file";gnome-fixpng-thumbnailer $file $file; done
You will guess why echoed the filename. Thats because this command could fail silently, (no $? with nonzero if fails) and the only clue you will have is a "ZLib error! -3" message. It's a quick solution because funnily enough you will find ipin.py does uncrush those files.
Read this for yet another tool around pngdefry. It provides an invaluable info about all this stuff -even its source- but I haven't tried myself.
My hope is in pngcrush absorbs those functionality so you have it out of the box, at least I have send a mail to pngcrush maintainer (hi Glenn).

Resources