![]() |
|
|
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 |
| copy lines from opne file to another | HIMANI | UNIX for Dummies Questions & Answers | 2 | 03-15-2008 05:57 AM |
| retrieved multiple lines on multiple places in a file | dala | Shell Programming and Scripting | 8 | 03-14-2008 03:28 PM |
| copy value to multiple lines | rko | Shell Programming and Scripting | 4 | 12-13-2007 10:56 PM |
| Copy only the initial 10 lines from a file to another | jockey007 | Shell Programming and Scripting | 5 | 11-02-2007 02:05 PM |
| Copy a file to multiple hosts | sumsriva | UNIX for Advanced & Expert Users | 5 | 09-18-2007 04:42 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to copy multiple lines from a file to another using AWK?
Hi,
I have a abc.txt file. In this file there is a SQL query which Iwant to copy and print it on another file.The query (for eg) is written like this: SELECT field1, field2, field3 from table1,table2 where <conditions> END I want to copy this query to another file using AWK.Its very urgent .Can someone help me in this. Thanks in advance. JS |
|
||||
|
Quote:
Code:
awk '/SELECT/,/END/{print}' abc.txt > newfile
|
|
||||
|
What If i dont want to print the first and the last line but everthing else?
For eg : I dont want to print the SELECT and Last line, END but have to print all lines in between these two? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|