Monday, 31 January 2011

Advanced SED Tutorial. Multiline Sed commands

1. If a line starts with / remove / sign.
$sed 's/^\/ *//g'

2. If a line starts with TABLESPACE remove it.
$sed 's/^TABLESPACE.*//g'

3. If line starts with ) proceeds with none or more spaces replace it with ) and next line.
$sed 's/^) */)\n\//g'

4. Replace ; with ; and next line.
$sed -i 's/;/;\n/g'

5. This command replaces ; \t\n\r or spaces and the / in a file to just \n /.
$sed ':a;N;$!ba;s/[^end];[\n\t\r ]*\//\n\//g'

First of all the filw is all read in come variable N and then we perform operation on it. Its a Multiline function.

6. Line starting with END or end or any of Upper or Lower combination of end, will be ended with a ;
$sed 's/^[eE][nN][dD].*/&;/g'

No comments:

Post a Comment

Executive Summary: Anthropic's Claude Mythos Model

  What Happened Anthropic announced  Claude Mythos Preview , a new AI model it describes as its most capable ever — and so powerful in cyber...