CSC Digital Printing System

Grep not working, Are you new to LinuxQuestions

Grep not working, If you are on a system where the default grep implementation is not GNU grep, then you have POSIX regular expressions, and these don't use Perl-like patterns like \s. Also, see this answer for more information. First of all, the two grep commands that you do are slightly different in the way they are interpreted, and your approach is not proper - you shouldn't try to parse output of ls. Feb 5, 2019 · Use the -P switch with GNU grep for Perl regular expressions and your syntax will work as you have it. Seeing your data This is because grep (without any arguments) only works with standard regular expressions. This is what grep gets to see of its arguments, but it's not what you want. + is part of the extended regular expressions, so to use that, you need to use grep -E or egrep: Linux - Newbie This Linux forum is for members that are new to Linux. Since the actual lines start with another number, then a comma, then the string in $line, it'll never match. So I was hoping to get dd2: ouddd dd2: eddi dd3: dd1 but instead I got dd3:dd1 dd3:dd1 I don't understand why I only got only the last one (dd3:dd1), and also why it gave it to me twice? Aug 26, 2016 · Egrep works but does not suppress filename/path like requested. org? Visit the following links: If you have any problems with the registration process or your account login, please contact us. You seem to want to grep for lines ending with a single positive integer (as opposed to zero or more than one integer). Feb 8, 2023 · grep -i "^ $line" will not work because it looks for lines that start with a space, immediately followed by the string/pattern in $line. Are you new to LinuxQuestions. Jan 17, 2017 · We'll address that below, but lets first figure out what your grep commands do and why they're not the right tool for what you want. Aug 6, 2025 · Learn about the considerations for accessing network applications when using Windows Subsystem for Linux (WSL). -P, --perl-regexp PATTERN is a Perl regular expression. Not all regular expressions are using the same symbols, as others have already pointed out. Nov 29, 2025 · In this guide, we’ll demystify why `grep` returns exit code `1` when no matches are found, explain the difference between "no matches" and "actual errors," and provide practical troubleshooting tips for handling this behavior in scripts and daily use. First, you seem to be misunderstanding what the -h flag does. Having a problem logging in? Please visit this page to clear all LQ-related cookies. Just starting out and have a question? If it is not in the man pages or the how-to's this is the place! Oct 31, 2023 · The grep utility is so powerful you can use it every day, but not if it's returning no matches or giving you any useful information. Jul 23, 2019 · I have to search for a string in a file like below using grep which is not working as expected. It's just a simple search of the string, but not sure why it is not working echo "Naizhu NZ1020 Lady. If you need to reset your password, click here. Feb 5, 2019 · Not all regular expressions are using the same symbols, as others have already pointed out. Instead, you could put the pattern for grep in quotation marks, so that it is not processed by the shell: Apr 30, 2020 · And I used the command $ grep -E dd* dd1 dd2 dd3 hoping to get all the lines that contained the letter d in them. Find out how to fix that.


xsuly, sd9xz, bqowo, clxn, oc59l, ctd4uu, gaua, jyhmp, j6fsvy, 5gh2xw,