Hi all,
Accounting to gnu/sed manual,
http://www.gnu.org/software/sed/manu...ar-Expressions
*
Matches a sequence of zero or more instances of matches for the preceding regular expression, which must be an ordinary character, a special character preceded by \, a ., a grouped regexp (see below), or a bracket expression.
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?
The man page for GNU's less utility says the following about searching:
/pattern
Search forward in the file for the N-th line containing the pattern. N
defaults to 1.
I do have a shell file where I call many unix commands . I would like to add a regular expression step in that shell file, where a text file, say Test.txt has to be openned and all the :'s should be replaced.
Basically apply the follwoing regular expression:
Code:
:%s/://g
to that particular text file, which is generated from a previous command in that shell script.
Please let me know
Suppose I want to append two digit numbers in my file with "some_thing".
Like from this:
12 23 45
to
12_something 23_something 45_something
How can I do this using regular expression replacement?
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:
-?
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.
I'm trying to use find with the regex option. However my regular expression only captures the basename of the file. Is there a reference to the "directory find is currently in" I can use in my regular expression so that I don't have to account for it by means of a leading .*?
After some quick searching and not finding the answer, I decided to write this up for my own reference.My original inquiry was how do I form a double-bracketed if branch statement, using "=~" to check a variable against a regular expression for upper OR lower case of a specific search string in bash. After some working it out, I think I got it.