08-16-2011
Quote:
Originally Posted by
gangii87
Hi All,
I have a small query. I have a file containing the following lines
File 1:
29-Jul-2011 [pattern1] GMT Static data requires update <Extraction should start here>
-----------
-----------
----------[pattern2]----------
-----------------------
-----------[pattern2] <should stop here>
Pattern1 will be time and pattern2 will be some userid:XYZ
I am trying to use following script, but it stops after the first occurrence of pattern2
awk ' /08:48:17/ { flag=1; } /gangii87/{ print $0; flag=0;} flag { print $0 }' log
Thanks
Hi, It could really help if you give a real input ..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
How can i delete the second and subsequent occurrence of a particular string from a file ?
eg) test.txt
cattle
bat
battle
mat
matter
cattle
cattle
my output file should be
cattle
bat
battle
mat
matter (12 Replies)
Discussion started by: gopskrish
12 Replies
2. Shell Programming and Scripting
Hi
I am new shell scripting, i need help on the follwoing
I have a application log file, the application is called on cron, the log includes a "started" and "finished" lines repeatedly. I need to get the log of the for the latest run of the application.
Sample log file
Started
adfa
fadfa... (8 Replies)
Discussion started by: rvz
8 Replies
3. Shell Programming and Scripting
Hi,
Here is a sample of my Test File
$ cat TestFile1
Prompt Table DQZ_ALTER_SCHEMA_ID;
ALTER TABLE DQZ.DQZ_ALTER_SCHEMA_ID MONITORING;
ALTER TABLE DQZ.DQZ_ALTER_SCHEMA_ID STORAGE ( NEXT 3464K );
Prompt Table DQZ_ALTER_SCHEMA_ID;
ALTER TABLE DQZ.DQZ_ALTER_SCHEMA_ID
MOVE LOB... (16 Replies)
Discussion started by: rajan_san
16 Replies
4. UNIX for Dummies Questions & Answers
Hi all,
1. I have a file that is getting continously refreshed (appended)
I want to grep all the strings containing substring of the type
abcdf123@aaa.xxx.yyy.zzz:portnumber:
where,
before @, any letters or numbers combination,
after @, IP address
then symbol :
then port... (4 Replies)
Discussion started by: kokoras
4 Replies
5. Shell Programming and Scripting
Thanks for the help yesterday. I have a little modification today,
I am trying the following:
i have a log file of a webbap which logs in the following pattern:
2011-08-14 21:10:04,535 blablabla ERROR Exception1 blablabla
bla
bla
bla
bla
2011-08-14... (2 Replies)
Discussion started by: ppolianidis
2 Replies
6. Shell Programming and Scripting
Guys,
I am trying the following:
i have a log file of a webbap which logs in the following pattern:
2011-08-14 21:10:04,535 blablabla ERROR blablabla
bla
bla
bla
bla
2011-08-14 21:10:04,535 blablabla ERROR blablabla
bla
bla
bla
... (6 Replies)
Discussion started by: ppolianidis
6 Replies
7. Shell Programming and Scripting
Hello, I'm looking for sed solution to change
...
<li>keyword</li>
<li>keyword
<li>keyword</li>
<li>keyword
<li>keyword</li>
...
to
...
<li>keyword</li>
<li>keyword</li>
<li>keyword</li>
<li>keyword</li>
<li>keyword</li>
...
I.e., if lines beginning with <li> do not end with... (3 Replies)
Discussion started by: pioavi
3 Replies
8. Shell Programming and Scripting
Hi experts,
I need a help in extracting a set of patterns from the text file.
Below is my scenario.
Input file:
I need to extract the data between
My output should be as
Thanks,
Kalai (7 Replies)
Discussion started by: kalpeer
7 Replies
9. Shell Programming and Scripting
Hi,
I want to add a text to the end of the specific line in a file. Now my file looks like this:
999
111
222
333
111
444
I want to add the string " 555" to the end of the first line contaning 111. Moreover, I want to insert a newline after this line containg the "000" string. The... (8 Replies)
Discussion started by: wenclu
8 Replies
10. UNIX for Dummies Questions & Answers
Hi,
I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies
LEARN ABOUT DEBIAN
makepattern
MAKEPATTERN(1gmt) Generic Mapping Tools MAKEPATTERN(1gmt)
NAME
makepattern - make GMT color pattern from b/w pattern or icon
SYNOPSIS
makepattern 1bit.ras | iconfile -Cfr/g/b -Cbr/g/b
DESCRIPTION
makepattern reads either a Sun 1-bit rasterfile OR a Sun icon file. It then accepts color choices for the foreground and background pixels
and colorizes the pattern, writing it as a 8-bit Sun rasterfile on stdout. These patterns may then be used in GMT (3.1 or later) -Gp set-
tings or by psimage.
1bit.ras | iconfile
Either a 1-bit Sun rasterfile (standard format, no RLE) or a Sun icon file (as used in GMT 3.0).
-Cf Sets the color for the foreground pixels (the ones) [black].
-Cb Sets the color for the background pixels (the zeros) [white].
WIN32 fix
Since binary redirection under WIN32 does not work, you must specify the output file with -Gnewfile.ras. This option is only available
under WIN32.
EXAMPLES
To create a colorized red/blue 8-bit Sun rasterfile pattern from the old 3.0-style iconpattern stored in file custom.icon, run
makepattern custom.icon -Cfred -Cbblue > custom.ras
To create a green/blue 8-bit Sun rasterfile pattern from a 1-bit Sun raster called bits.ras, run
makepattern bits.ras -Cfgreen -Cbblue > colorbits.ras
SEE ALSO
GMT(1), psimage(1)
GMT 4.5.7 15 Jul 2011 MAKEPATTERN(1gmt)