Skip to main content
15 events
when toggle format what by license comment
Jan 5, 2021 at 0:38 comment added Olivier Dulac @Heiko thanks a lot for the coffee :) (Its greatly appreciated, even though it was just a little informations). I will delete this comment.
Jan 3, 2021 at 0:56 comment added Heiko mywiki.wooledge.org
Jan 2, 2021 at 23:53 comment added Olivier Dulac @Heiko: actually, most of what you used there are also available in regexes. You seem on a good path to learn! For the shell part, I can recommand: wooledge.com website (mostly: the "bashpitfalls" page, the guide, and the faq : all are recommended reading, but maybe in a few days/weeks))
Jan 2, 2021 at 23:37 comment added Heiko @OlivierDulac I've just yesterday learned about wildcards and practiced it. Most complicated I did was ls [![:digit:]]*[a-z][0-9][0-9][0-9][aA-zZ]*[![:digit:]] It's not the easiest stuff to wrap the beginners head around .. guess that will get even worse with regex .. but I'll practice this, it's totally fascinating.
Jan 2, 2021 at 23:31 comment added Olivier Dulac and "normal" shells do not use regex unless under very specific circumstances. They usually do "globbing" instead against filenames inthe current directory in general.
Jan 2, 2021 at 23:27 comment added Olivier Dulac @Heiko: in shell: you can do : for file in a*b ; do something with "$file" ; done (will be filling the file variable with any file starting with a and finishing with b in the current directory, and each time execute : something with "$file" ), or also : for file in a*[bcd] ; do ... (any files starting with a, and ending in b, c or d). in regex: ^a.*b$ and ^a.*[bcd]$ would be "close" approximations (but now it is usually used to match against a text string, not a file or directory name).
Jan 2, 2021 at 23:23 comment added Olivier Dulac @Heiko : in shell command line: * matching is called "globbing", and follows different rules than regexes. And as noted above, there are also many variant of regexes. Practice will make it all make sense ^^.
Jan 2, 2021 at 23:19 comment added Heiko I have not looked at regex yet .. just passed the bash wildcards chapter in the book I'm following and tried to adapt this in Vim. But thanks, that is very valuable information. I'll pay attention to this and practice it .. so powerful when done correctly.
Jan 2, 2021 at 23:14 comment added Olivier Dulac note also: each program (vim, python, grep, awk, etc) use one or another variant of regular expression matching. For exemple : in grep or sed, you may have to change any literral "|" with "\|", so that it is not taked as an "or" ( ex: egrep "foo|bar" matches any lines containing "foo" or "bar" ... egrep "foo\|bar" will instead match lines containing "foo|bar" ). Experiment (and there are great sites explaining it all, such as regular-expressions.info)
Jan 2, 2021 at 23:12 comment added Olivier Dulac @Heiko : careful, your last comment also would match a |010abcde , and change this into abcde .. better add the 2 "limits" (the | on either sides) to ensure only 3 occurences between 2 pipes are matched, and not something starting with 3 occurences instead.
Jan 2, 2021 at 23:10 comment added Heiko Yes, I think I get it now .. 70,77s/|[01][01][01]/ worked as well - that is what I've tried first without the stars.
Jan 2, 2021 at 23:05 comment added Heiko Thank you that worked! But have to state that I don't get it .. I don't need the stars in Vim, they caused the problem, is that right?
Jan 2, 2021 at 23:02 vote accept Heiko
Jan 2, 2021 at 22:59 history edited Olivier Dulac CC BY-SA 4.0
deleted 1 character in body
Jan 2, 2021 at 22:52 history answered Olivier Dulac CC BY-SA 4.0