Remove multiple lines from a particular string to particular string
Hi,
I have a file containing the DDLs of tables in a schema. From that I need to remove all the lines from a starting string till a specific string. Here is an example.
File1.txt
-------------
------------------------
In the above file I am searching for "USING INDEX" and it will remove all the lines starting from the line having "USING INDEX" till it founds ")"
The o/p should be:
-------------------------------------
-------------------------------------
Thanks in advance.
regards,
Satya
Last edited by Franklin52; 05-02-2013 at 07:59 AM..
Reason: Please use code tags
Can someone tell me how I can do this?
e.g:
Say file1.txt contains:
today is monday
the 22 of
NOVEMBER
2010
and file2.txt contains:
the
11th
month
of
How do i replace the word NOVEMBER with (5 Replies)
Can someone tell me how I can do this?
e.g:
a=$(echo -e wert trewt ertert ertert ertert erttert
erterte
rterter
tertertert
ert)
How do i replace the STRING with $a?
I try this:
sed -i 's/STRING/'"$a"'/g' filename.ext
but this don' t work (2 Replies)
Hey guys. I know pratically 0 about Linux, so could anyone please give me instructions on how to accomplish this ?
The distro is RedHat 4.1.2 and i need to find and replace a multiple lines string in several php files across subdirectories.
So lets say im at root/dir1/dir2/ , when i execute... (12 Replies)
Hi,
I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
i have file input
aa,20120626 bb,45Cexpect to remove all lines when $2 doesn't end with 'C"
output
bb,45Ci tried this
sed -i -nl -e '/\<C\>/ {p;} ' file1
but the result : sed illegal option -i (5 Replies)
Gurus,
I am relatively new to Unix scripting and am struck with a problem in my script. I have positional input file which has a FLAG indicator in at position 11 in every record of the file.
If the Flag has value =Y, then the record from the input needs to be written to a new file.However if... (3 Replies)
Hello Guys,
I need to replace a string with multiple lines.
For eg:-
ABC,DEF,GHI,JKL,MNO,PQR,STU
need to convert the above as below:-
ABC,DEF,
GHI1
GHI2
GHI3,
JKL,MNO,
PQR1
PQR2
PQR3,
STU
i have tried using code as:- (2 Replies)
I have a file that looks like this:
DIP-27772N DIP-18408N refseq:NP_523941
DIP-23436N|refseq:NP_536784 DIP-23130N|refseq:NP_652017
DIP-22958N|refseq:NP_651195 DIP-20072N|refseq:NP_724597
DIP-22928N|refseq:NP_569972 DIP-22042N|refseq:NP_536744|uniprotkb:P54622... (4 Replies)