- How to match whitespace in sed? - Super User
How can I match whitespace in sed? In my data I want to match all of 3+ subsequent whitespace characters (tab space) and replace them by 2 spaces How can this be done?
- How to match digits followed by a dot using sed? - Super User
The sed man page references the re_format man page It makes 2 distinctions: (1) obsolete versus extended regular expressions; (2) non-enhanced versus enhanced regular expressions All 4 combinations are possible There is support in sed for both obsolete and extended, but in either case only for non-enhanced The \d operator is a feature of enhanced regular expressions, therefore not
- bash - How to use sed with piping - Super User
For all reasonably modern GNU sed, however, -E is an undocumented synonym for -r The rumor is that POSIX has settled on -E, which BSD OSX already uses, and, if that is added to the final standard, we will all be transitioning to -E
- linux - sed -r vs. sed - exactly how are the regex possibilities . . .
In bash, as I understand it, I can use characters like ^ * in regular expressions with sed, but the -r option changes the nature of how regular expressions are, uh, expressed, kinda like grep vs grep -E
- replacing only part of matched pattern in sed - Super User
So it is the parenthesis, not anything to do with the square brackets, that the \1 refers to Likewise, \2 refers to what gets specified by the second set of parenthesis Also, from my reading, -E may be documented in bsd sed, undoc'ed in GNU sed (GNU sed doc's -r instead), and if -r is used, parenthesis may need to be escaped
- Sed for windows - Super User
I would highly recommend cygwin, the windows shell is such a PITA for unix-like commands However, if you are planning on sticking with the windows shell, the easiest way ive found to run sed or awk is by creating a script file and then calling the file with the -f flag For example sed -f some_sed_script sed or awk -f some_awk_script awk
- How can I do a recursive find and replace from the command line?
Using a shell like bash or zshell, how can I do a recursive 'find and replace'? In other words, I want to replace every occurrence of 'foo' with 'bar' in all files in this directory and its
- sed: cant read : No such file or directory - Super User
will do, if your sed version supports the -- option of course You could replace the trailing \; (that means end of arguments of command to execute) by + so that sed will be launched with as many arguments it can handle, so it will not be spawned once per file
|