Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

tl;dr see fd0fd0's solution

I did look in the man page before asking, but failed to notice the relevant info, since I figured it doesn't differ significantly from that of Linuxes. But,

$ man sed ... -E Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats. $ man re_format ... Obsolete (“basic”) regular expressions differ in several respects. ‘|’ is an ordinary character and there is no equivalent for its functional‐ ity. ‘+’ and ‘?’ are ordinary characters, and their functionality can be expressed using bounds (‘{1,}’ or ‘{0,1}’ respectively). Also note that ‘x+’ in modern REs is equivalent to ‘xx*’. The delimiters for bounds are ‘\{’ and ‘\}’, with ‘{’ and ‘}’ by themselves ordinary characters. 

And I did try to use {1,}, I just forgot to escape curly brackets. So surely fd0fd0's solution is generally the best way possible. But others would be:

$ echo ' found' | sed -n '/[[:blank:]]\{1,\}/p' found $ echo ' found' | sed -n '/[[:blank:]][[:blank:]]*/p' found 

However, not sure what they meant by

Also note that ‘x+’ in modern REs is equivalent to ‘xx*’

Meaning, what it was like in nonmodern ones.

Also, grep's manpage didn't mention re_format entry, which apparently means it has its own implementation of regular expressions. For that matter, it was GNU grep, as opposed to sed.

tl;dr see fd0's solution

I did look in the man page before asking, but failed to notice the relevant info, since I figured it doesn't differ significantly from that of Linuxes. But,

$ man sed ... -E Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats. $ man re_format ... Obsolete (“basic”) regular expressions differ in several respects. ‘|’ is an ordinary character and there is no equivalent for its functional‐ ity. ‘+’ and ‘?’ are ordinary characters, and their functionality can be expressed using bounds (‘{1,}’ or ‘{0,1}’ respectively). Also note that ‘x+’ in modern REs is equivalent to ‘xx*’. The delimiters for bounds are ‘\{’ and ‘\}’, with ‘{’ and ‘}’ by themselves ordinary characters. 

And I did try to use {1,}, I just forgot to escape curly brackets. So surely fd0's solution is generally the best way possible. But others would be:

$ echo ' found' | sed -n '/[[:blank:]]\{1,\}/p' found $ echo ' found' | sed -n '/[[:blank:]][[:blank:]]*/p' found 

However, not sure what they meant by

Also note that ‘x+’ in modern REs is equivalent to ‘xx*’

Meaning, what it was like in nonmodern ones.

Also, grep's manpage didn't mention re_format entry, which apparently means it has its own implementation of regular expressions. For that matter, it was GNU grep, as opposed to sed.

tl;dr see fd0's solution

I did look in the man page before asking, but failed to notice the relevant info, since I figured it doesn't differ significantly from that of Linuxes. But,

$ man sed ... -E Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats. $ man re_format ... Obsolete (“basic”) regular expressions differ in several respects. ‘|’ is an ordinary character and there is no equivalent for its functional‐ ity. ‘+’ and ‘?’ are ordinary characters, and their functionality can be expressed using bounds (‘{1,}’ or ‘{0,1}’ respectively). Also note that ‘x+’ in modern REs is equivalent to ‘xx*’. The delimiters for bounds are ‘\{’ and ‘\}’, with ‘{’ and ‘}’ by themselves ordinary characters. 

And I did try to use {1,}, I just forgot to escape curly brackets. So surely fd0's solution is generally the best way possible. But others would be:

$ echo ' found' | sed -n '/[[:blank:]]\{1,\}/p' found $ echo ' found' | sed -n '/[[:blank:]][[:blank:]]*/p' found 

However, not sure what they meant by

Also note that ‘x+’ in modern REs is equivalent to ‘xx*’

Meaning, what it was like in nonmodern ones.

Also, grep's manpage didn't mention re_format entry, which apparently means it has its own implementation of regular expressions. For that matter, it was GNU grep, as opposed to sed.

deleted 1 character in body
Source Link
x-yuri
  • 3.6k
  • 13
  • 46
  • 70

tl;dr see fd0's solution

I did look in the man page before asking, but failed to notice the relevant info, since I figured it doesn't differ significantly from thosethat of Linuxes. But,

$ man sed ... -E Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats. $ man re_format ... Obsolete (“basic”) regular expressions differ in several respects. ‘|’ is an ordinary character and there is no equivalent for its functional‐ ity. ‘+’ and ‘?’ are ordinary characters, and their functionality can be expressed using bounds (‘{1,}’ or ‘{0,1}’ respectively). Also note that ‘x+’ in modern REs is equivalent to ‘xx*’. The delimiters for bounds are ‘\{’ and ‘\}’, with ‘{’ and ‘}’ by themselves ordinary characters. 

And I did try to use {1,}, I just forgot to escape curly brackets. So surely fd0's solution is generally the best way possible. But others would be:

$ echo ' found' | sed -n '/[[:blank:]]\{1,\}/p' found $ echo ' found' | sed -n '/[[:blank:]][[:blank:]]*/p' found 

However, not sure what they meant by

Also note that ‘x+’ in modern REs is equivalent to ‘xx*’

Meaning, what it was like in nonmodern ones.

Also, grep's manpage didn't mention re_format entry, which apparently means it has its own implementation of regular expressions. For that matter, it was GNU grep, as opposed to sed.

tl;dr see fd0's solution

I did look in the man page before asking, but failed to notice the relevant info, since I figured it doesn't differ significantly from those of Linuxes. But,

$ man sed ... -E Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats. $ man re_format ... Obsolete (“basic”) regular expressions differ in several respects. ‘|’ is an ordinary character and there is no equivalent for its functional‐ ity. ‘+’ and ‘?’ are ordinary characters, and their functionality can be expressed using bounds (‘{1,}’ or ‘{0,1}’ respectively). Also note that ‘x+’ in modern REs is equivalent to ‘xx*’. The delimiters for bounds are ‘\{’ and ‘\}’, with ‘{’ and ‘}’ by themselves ordinary characters. 

And I did try to use {1,}, I just forgot to escape curly brackets. So surely fd0's solution is generally the best way possible. But others would be:

$ echo ' found' | sed -n '/[[:blank:]]\{1,\}/p' found $ echo ' found' | sed -n '/[[:blank:]][[:blank:]]*/p' found 

However, not sure what they meant by

Also note that ‘x+’ in modern REs is equivalent to ‘xx*’

Meaning, what it was like in nonmodern ones.

Also, grep's manpage didn't mention re_format entry, which apparently means it has its own implementation of regular expressions. For that matter, it was GNU grep, as opposed to sed.

tl;dr see fd0's solution

I did look in the man page before asking, but failed to notice the relevant info, since I figured it doesn't differ significantly from that of Linuxes. But,

$ man sed ... -E Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats. $ man re_format ... Obsolete (“basic”) regular expressions differ in several respects. ‘|’ is an ordinary character and there is no equivalent for its functional‐ ity. ‘+’ and ‘?’ are ordinary characters, and their functionality can be expressed using bounds (‘{1,}’ or ‘{0,1}’ respectively). Also note that ‘x+’ in modern REs is equivalent to ‘xx*’. The delimiters for bounds are ‘\{’ and ‘\}’, with ‘{’ and ‘}’ by themselves ordinary characters. 

And I did try to use {1,}, I just forgot to escape curly brackets. So surely fd0's solution is generally the best way possible. But others would be:

$ echo ' found' | sed -n '/[[:blank:]]\{1,\}/p' found $ echo ' found' | sed -n '/[[:blank:]][[:blank:]]*/p' found 

However, not sure what they meant by

Also note that ‘x+’ in modern REs is equivalent to ‘xx*’

Meaning, what it was like in nonmodern ones.

Also, grep's manpage didn't mention re_format entry, which apparently means it has its own implementation of regular expressions. For that matter, it was GNU grep, as opposed to sed.

Added tl;dr
Source Link
x-yuri
  • 3.6k
  • 13
  • 46
  • 70

tl;dr see fd0's solution

I did look in the man page before asking, but failed to notice the relevant info, since I figured it doesn't differ significantly from those of Linuxes. But,

$ man sed ... -E Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats. $ man re_format ... Obsolete (“basic”) regular expressions differ in several respects. ‘|’ is an ordinary character and there is no equivalent for its functional‐ ity. ‘+’ and ‘?’ are ordinary characters, and their functionality can be expressed using bounds (‘{1,}’ or ‘{0,1}’ respectively). Also note that ‘x+’ in modern REs is equivalent to ‘xx*’. The delimiters for bounds are ‘\{’ and ‘\}’, with ‘{’ and ‘}’ by themselves ordinary characters. 

And I did try to use {1,}, I just forgot to escape curly brackets. So surely fd0's solution is generally the best way possible. But others would be:

$ echo ' found' | sed -n '/[[:blank:]]\{1,\}/p' found $ echo ' found' | sed -n '/[[:blank:]][[:blank:]]*/p' found 

However, not sure what they meant by

Also note that ‘x+’ in modern REs is equivalent to ‘xx*’

Meaning, what it was like in nonmodern ones.

Also, grep's manpage didn't mention re_format entry, which apparently means it has its own implementation of regular expressions. For that matter, it was GNU grep, as opposed to sed.

I did look in the man page before asking, but failed to notice the relevant info, since I figured it doesn't differ significantly from those of Linuxes. But,

$ man sed ... -E Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats. $ man re_format ... Obsolete (“basic”) regular expressions differ in several respects. ‘|’ is an ordinary character and there is no equivalent for its functional‐ ity. ‘+’ and ‘?’ are ordinary characters, and their functionality can be expressed using bounds (‘{1,}’ or ‘{0,1}’ respectively). Also note that ‘x+’ in modern REs is equivalent to ‘xx*’. The delimiters for bounds are ‘\{’ and ‘\}’, with ‘{’ and ‘}’ by themselves ordinary characters. 

And I did try to use {1,}, I just forgot to escape curly brackets. So surely fd0's solution is generally the best way possible. But others would be:

$ echo ' found' | sed -n '/[[:blank:]]\{1,\}/p' found $ echo ' found' | sed -n '/[[:blank:]][[:blank:]]*/p' found 

However, not sure what they meant by

Also note that ‘x+’ in modern REs is equivalent to ‘xx*’

Meaning, what it was like in nonmodern ones.

Also, grep's manpage didn't mention re_format entry, which apparently means it has its own implementation of regular expressions. For that matter, it was GNU grep, as opposed to sed.

tl;dr see fd0's solution

I did look in the man page before asking, but failed to notice the relevant info, since I figured it doesn't differ significantly from those of Linuxes. But,

$ man sed ... -E Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats. $ man re_format ... Obsolete (“basic”) regular expressions differ in several respects. ‘|’ is an ordinary character and there is no equivalent for its functional‐ ity. ‘+’ and ‘?’ are ordinary characters, and their functionality can be expressed using bounds (‘{1,}’ or ‘{0,1}’ respectively). Also note that ‘x+’ in modern REs is equivalent to ‘xx*’. The delimiters for bounds are ‘\{’ and ‘\}’, with ‘{’ and ‘}’ by themselves ordinary characters. 

And I did try to use {1,}, I just forgot to escape curly brackets. So surely fd0's solution is generally the best way possible. But others would be:

$ echo ' found' | sed -n '/[[:blank:]]\{1,\}/p' found $ echo ' found' | sed -n '/[[:blank:]][[:blank:]]*/p' found 

However, not sure what they meant by

Also note that ‘x+’ in modern REs is equivalent to ‘xx*’

Meaning, what it was like in nonmodern ones.

Also, grep's manpage didn't mention re_format entry, which apparently means it has its own implementation of regular expressions. For that matter, it was GNU grep, as opposed to sed.

Source Link
x-yuri
  • 3.6k
  • 13
  • 46
  • 70
Loading