I've tried to removed the binary columns in my octal help function.
First echo is in line 70, I wanted to delete |000 and the same pattern .. first | + three numerals for all echo lines.
So I have tried this:
- :
70,77s/*|[01][01][01]*/
- :
70,77s/*|[0-1][0-1][0-1]*/
- :
70,77s/*|[0..1][0..1][0..1]*/
Outcome for all three was E486: Pattern not found.
Do I have to escape something here or what did I do wrong?
# octal will show octal permission scheme for chmod command
function octal {
echo "|0|000|---|";
echo "|1|001|--x|";
echo "|2|010|-w-|";
echo "|3|011|-wx|";
echo "|4|100|r--|";
echo "|5|101|r-x|";
echo "|6|110|rw-|";
echo "|7|111|rwx|";
echo 'Example: chmod 777 file = -rwxrwxrwx';
echo 'Example: chmod 600 file = -rw-------';
}
70,77s/*|???*/
… same result. – Heiko Jan 02 '21 at 22:46echo "|0|000|---|";
… after:echo "|0|---|";
– Heiko Jan 02 '21 at 22:53*
is not a wildcard. in regex it would be :.*
, ie "any character" (.
) "repeated 0,1 or n times" (*
), ie a string of any length (and any content).*
alone is often taken as a literral*
, unless it is preceded with something.cars*
: will match:car
cars
carsssssssss
etc, for exemple. but*cars
will match any line containing*cars
in it, literrally (*
being the first character, it is taken literrally as it can't "repeat 0, 1 or n times" something before it) – Olivier Dulac Jan 02 '21 at 23:05