Patterns in awk and sed
by Faki from LinuxQuestions.org on (#5RGGX)
Have noticed that a pattern used with awk such as
Code:charcl='^[[:space:]]*([#;!]+|@c|\/\/)[[:space:]]*'
begrec="${charcl}"'Mode: rec$'has to be modified for use with `sed` by escaping the `()`.
Code:charcl='^[[:space:]]*\([#;!]+\|@c\|\/\/\)[[:space:]]*'
begrec="${charcl}"'Mode: rec$'Is this correct? I would like to set the same pattern in `charcl` for use in both `awk` and `sed` commands.
Code:charcl='^[[:space:]]*([#;!]+|@c|\/\/)[[:space:]]*'
begrec="${charcl}"'Mode: rec$'has to be modified for use with `sed` by escaping the `()`.
Code:charcl='^[[:space:]]*\([#;!]+\|@c\|\/\/\)[[:space:]]*'
begrec="${charcl}"'Mode: rec$'Is this correct? I would like to set the same pattern in `charcl` for use in both `awk` and `sed` commands.