![]() |
|
|
|
|
|||||||
| 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 |
| copy lines from opne file to another | HIMANI | UNIX for Dummies Questions & Answers | 2 | 03-15-2008 02:57 AM |
| retrieved multiple lines on multiple places in a file | dala | Shell Programming and Scripting | 8 | 03-14-2008 12:28 PM |
| copy value to multiple lines | rko | Shell Programming and Scripting | 4 | 12-13-2007 07:56 PM |
| Copy only the initial 10 lines from a file to another | jockey007 | Shell Programming and Scripting | 5 | 11-02-2007 11:05 AM |
| Copy a file to multiple hosts | sumsriva | UNIX for Advanced & Expert Users | 5 | 09-18-2007 12:42 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Quote:
Code:
awk '/SELECT/,/END/{print}' abc.txt > newfile
|
|
#3
|
|||
|
|||
|
Thanku so much its working perfectly !!
|
|
#4
|
|||
|
|||
|
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? |
|||
| Google The UNIX and Linux Forums |