![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to delete content in a file (delete content only) | kittusri9 | Shell Programming and Scripting | 5 | 05-15-2008 01:12 PM |
| file moving based on file content | melvyn.cochrane | Shell Programming and Scripting | 12 | 02-15-2008 06:10 AM |
| extract content from a file and insert to another file | fredao | Shell Programming and Scripting | 15 | 12-06-2006 07:36 PM |
| Using the content of a file in the name of another | anriot | Shell Programming and Scripting | 2 | 09-18-2006 07:56 PM |
| transfer of specific file content to another file | mem101 | Shell Programming and Scripting | 1 | 10-18-2005 02:01 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Content extract of a file using awk
Hi Everyone,
I have a file with the below content: File1.txt ====== ### ###==> the below table was created for testing1 purpose; ### create table 123 ( field1 date, field2 char(10) primary key(field1) ); ### ###==> the below table was created for testing2 purpose; ### create table abc ( fielda1 date, fielda2 char(10) ); Question: I would like to print only the 'create table' statements like below: Sample Output: =========== create table 123 ( field1 date, field2 char(10) primary key(field1) ); create table abc ( fielda1 date, fielda2 char(10) ); any hints would be much appreciated. Thanks. RaviShankar |
|
|||||
|
learning awk is very good, but also try to learn when to use what. if you can do something using grep, cut etc. why invoke awk and lose on performance? this would make it clear
this is one place for learning awk |
|
||||
|
Code:
awk ' !/^#|^$/' file |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| awk, egrep |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|