Hi,
what ?* means in sh script?
I know that ? is equivalent to at least one appearance of a preceding expression and * is equivalent to at least one appearance of preceding expression but I have difficulties with a way in which I should interpret following pattern:
-?*
I would expect that it should match expressions like -, --, --- because I read it as follows:
-?
I recently got into a friendly argument with Ghoti about what constitutes a regular expression in the comments to my answer to this question. I claimed that the following is a regular expression:
`[Rr]eading[Tt]est[Dd]ata`
Ghoti disagreed, claiming it is a file glob instead.
How do you do grouping in grep? Here's how I tried it at first:
Code:
egrep qualit(y|ies) /usr/share/dict/words
-bash: syntax error near unexpected token `('
I'm using GNUgrep, and I found this on their site. grep regular expression syntax
Quote:
Grouping is performed with backslashes followed by parentheses \(, \).
When it comes to PHP, there is really on one true Regular Expression (Regex) standard to use. It is called PCRE (Perl-Compatible Regular Expressions). You might not even know that you were using PCRE, but chances are that you were. … [ Continue ]
The following command will tar all "dot" files and folders:
tar -zcvf dotfiles.tar.gz .??*
I am familiar with regular expressions, but I don't understand how to interpret .??*. I executed ls .??* and tree .??* and looked at the files which were listed. Why does this regular expression include all files within folders starting with . for example?
TweetGrep is one of the most important tools for a shell user. When it comes to retrieving required data from a bulk of text, grep is your best bet. Its very flexible, powerful and as I came to know today, has an interesting story too.
It all started a long time ago.
I have been reading the man pages for test(1), bash(1) and dash(1), but I can't figure out the meaning of this test :
[ `echo hi` > /dev/null ]
According to the man pages, there are two types of conditional expressions, primary and combined. Combined expressions are expressions combined of primaries.
Hello all.
I'm scripting in ksh and trying to put together a regular expression. I think my logic is sound, but I'm doing the head-against-the-wall routine while trying to put the individual pieces together. Can anybody lend some suggestions to the below problem?
I'm taking a date in the format of "DD-MMM-YY" as a parameter for a script.
The parentheses allows you to use regular expressions to perform string matches, or matches to actual words. Thus you may write a search that is looking for “virtual” or “main” with...