10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all,
I want to extract rows with the pattern ALPHANUMERIC/ALPHANUMNERIC in the 2nd column.
I dont wan rows with more than 1 slash or without any slash in 2nd column.
a a/b
b a/b/c
c a/b//c
d t/y
e r
f /f
I came up with the regex
grep '\/$' file
a a/b
b a/b/c
d t/y (3 Replies)
Discussion started by: jianp83
3 Replies
2. UNIX for Dummies Questions & Answers
I am trying to find patterns in files using grep -l -e. I specifically am searching for abc. I want any file that has abc in it, but not just the letters abc. I am searching for a pattern a followed by b followed by c. I have tried egrep -l and also I have tried the following:
grep -el... (2 Replies)
Discussion started by: newbie2010
2 Replies
3. Shell Programming and Scripting
Hi,
I'm trying to validate if a string matches a regular expression, but it is not working. Am I missing something? Do I need to scape any of the characters?
if echo 'en-GB' | egrep '({1,8})(-{1,8})*' >/dev/null; then
echo Valid value
fi
Thanks in advance (6 Replies)
Discussion started by: skrtxao
6 Replies
4. Shell Programming and Scripting
I want to be able to get all the directories in a path into a variable array, BUT if there ARE NO directories I want the Variable to be NULL and not echo any error message!
If there ARE directories, this will get the list of the directories whose name begins with the string "20":... (6 Replies)
Discussion started by: pgorbas
6 Replies
5. Shell Programming and Scripting
Hi,
I've a logfile which i need to parse and get the logs depending upon the user input. here, i'm providing an option to enter the string which can be matched with the log entries.
e.g. one of the logfile entry reads like this -
$str = " mpgw(BLUESOAPFramework):... (6 Replies)
Discussion started by: butterfly20
6 Replies
6. Shell Programming and Scripting
I need scan through some files, then open the file one by one and scan inside the file using perl to see if it contain a start tag and end tag which the end tag is the mirror image of the start tag, the start tag and end tag only have 5 char. And inside the file there is "http://". It is just a... (5 Replies)
Discussion started by: blueblur
5 Replies
7. Shell Programming and Scripting
Hi folks,
Lets say I have the following text file:
name, lastname, 1234, name.lastname@test.com
name1, lastname1, name2.lastname2@test.com, 2345
name, 3456, lastname, name3.lastname3@test.com
4567, name, lastname, name4.lastname4@test.com
I now need the following output:
1234... (5 Replies)
Discussion started by: domi55
5 Replies
8. Shell Programming and Scripting
Let's say I'm trying to match potentially multiple sets of parentheses. Is there a way in a regular expression to force a match of closing parentheses specifically in the number of the opening parentheses?
For example, if the string is "((foo bar))", I want to be able to say "match any number of... (7 Replies)
Discussion started by: cvp
7 Replies
9. Shell Programming and Scripting
Hello,
I would assume the expression ^$ should match a null string. Yet when I run:
echo -n | sed 's/^$/nullstring/'
I get no output.
Can anyone tell me why? (6 Replies)
Discussion started by: Allasso
6 Replies
10. Shell Programming and Scripting
I want to use find to locate files with two different extensions, and run a grep on the results. The closest I have gotten is incredibly slow and ugly:
for i in `ls -laR|egrep -e '(.js|.css)'`; do find . -name $i -print|xargs grep -H searchBg; done;
This method makes my eyes bleed. Help! ;)
... (2 Replies)
Discussion started by: r0sc0
2 Replies