![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to replace a line content | victorcheung | Shell Programming and Scripting | 13 | 04-21-2008 05:46 PM |
| How to convert C source from 8bit chars to 16bit chars? | siegfried | Shell Programming and Scripting | 0 | 09-26-2007 11:26 AM |
| Deleting all content in a file from command line | kingdbag | UNIX for Dummies Questions & Answers | 2 | 07-20-2006 04:00 PM |
| Using PERL to append chars to each line | c0nn0r | Shell Programming and Scripting | 5 | 07-11-2006 04:55 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Get multiple line content between two chars
Hello -
I have a file that has the something like the following : REM CREATE TABLE lots of text REM table specifc creation text ; REM ALTER TABLE lots of text REM text specific to the the alter command REM could be more lines of text; What I need is to get all the lines for the ALTER TABLE statement up to the ending ; into a seperate file. There are multiple statements within the file and some could be one line some could span more than one line but they all end in a ; Thanks in advance for your help. Feliz |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
sed -n '/ALTER TABLE/,/;/p' file Code:
sed -n -e '/ALTER TABLE/,/;/{' -e 's/^REM //p' -e } file
|
|
#3
|
|||
|
|||
|
Thank you. I also found that this did the trick for me.
awk '/ALTER/,/;/' zpdm1_tab.sql > zpdm1_con.sql Thanks for your reply. |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | |
| Display Modes | |
|
|