Ok, cool. You gave me some insight. For reference, the below line returns lines with exactly 3 matches if 'x' in the entire line.
3 can be replaced with any positive integer.
'x' can be replaced by any string.
Addinging the option -E allowed to removed the "\" for the special characters and the code worked as expected.
There is also -P option for Perl extensions.
-E returned nothing when I added the ?: to ()
-P returned everything
I'm getting closer, I'll just need sometime to fool around with it. Thanks for the help.
I'm trying to grep a long ls by looking at the beginning of each filename for example:
Many files begin with yong_ho_free_2005...
Many files begin with yong_ho_2005...
I can't just use "grep yong_ho" otherwise It'll display both files.
So I'm trying to use a regex but my syntax is wrong.
... (2 Replies)
I am wondering if there is a way via grep and sed to extract a string that is on the 2nd line below a known marker as in this example:
TextRel 203 0 0 "WELL:"
SetPosAbs 1287 -6676
TextRel 210 0 0 "AEP #2"
The marker is WELL:, but the string I need is "AEP #2". Can grep/sed handle this... (19 Replies)
I want it to find lines that contain any number of capital letters before P
this is what I have tried
echo "AAAAAP" | grep 'P'
echo "AAAAAP" | grep '\{1\}P'
echo "AAAAAP" | grep '^*P'
But none of them seem to work, any help is much appreciated
thanks
Calypso (4 Replies)
Hello,
This is my first post so, Hello World! Anyways, I'm learning how to use unix and its quickly become apparent that a strong foundation in regular expressions will make things easier. I'm not sure if my syntax is messing things up or my logic is messing things up.
ps -e | grep... (4 Replies)
Hello,
I'm working on learning regular expressions and what I can do with them. I'm using unix to and its programs to experiment and learn what my limitations are with them.
I'm working on duplicating the regular expression:
^(.*)(\r?\n\1)+$
This is supposed to delete duplicate lines... (2 Replies)
Hello,
I looking to use grep to return a string with exactly n matches.
I'm building off this:
ls -aLl /bin | grep '^.\{9\}x' | tr -s ' '
-rwxr-xr-x 1 root root 632816 Nov 25 2008 vi
-rwxr-xr-x 1 root root 632816 Nov 25 2008 view
-rwxr-xr-x 1 root root 16008 May 25 2008... (7 Replies)
I have a directory I need to grep which consists of numbered sub directories. The sub directory names change daily. A file resides in this main directory that shows which sub directories are FULL backups or INCREMENTAL backups.
My goal is to grep the directory for the word "full" and then... (2 Replies)
Hello guys,
Here i am writing a script in bash to check for a valid URL from a file using regex
This is my input file
http://www.yahoo.commmmmm
http://www.google.com
https://www.gooogle.co
www.test6.co.in
www.gmail.com
www.google.co
htt://www.money.com
http://eeeess.google.com... (2 Replies)
Dear Team
/app/Appln/logs/
echo Session used server are 'grep -i pid|grep -i session | cut -d'.' -f1 | awk '{print $9}' | sort | uniq'
Output -
lxserver01
lxserver02
lxserver03
When I grep session pid in logs server details I can see above distinct server details but I... (6 Replies)