06-18-2008
A beautifully elegant solution that, more importantly, works
Many thanks Yogesh.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a file. I need to find multiple patterns in a row and need those rows to divert to new file.
I tried using grep -e / -E / -F options as given in man.
But its not working.
==> cat testgrep.txt
william,fernandes,xxxxx
mark,morsov,yyyy
yy=,xx=
yyyy=,xxxx==
==>... (7 Replies)
Discussion started by: WillImm123
7 Replies
2. Shell Programming and Scripting
I need a simple script to get all lines between 2 Patterns,
e.g.
.............
.............
114456723: testing Script
Alpha
Beta
114459234: testing Done
.............
.............
It should give all the lines in between 114456723 and 114459234, including these as well.
Any... (2 Replies)
Discussion started by: gurpreet470
2 Replies
3. Shell Programming and Scripting
Hi All,
I've been trying solve this with a simple command but not having much luck. I have a file like this:
Line 1: random_description 123/alert/high random_description2 356/alert/slow
Line 2: random_description3 654/alert/medium
Line 3: random_description4 234/alert/critical
I'm... (7 Replies)
Discussion started by: joe19
7 Replies
4. UNIX for Dummies Questions & Answers
I have a file with the following text:
grep \$
grep \\$
grep \\\$
grep '\$'
grep '\'$'
grep \\
grep \\\\
grep "\$"
grep '"$'
grep "$"
When I perform these same commands on this file, the result are never what I would expect them to be. Could someone please comment on the results and... (3 Replies)
Discussion started by: uran101
3 Replies
5. Shell Programming and Scripting
Hello guys,
I have been looking around but can't find the answer to my problem:
If the grep command displays no results, print "no results have been found" and increment x. But if the grep command find something, do nothing.
if
echo "no results have been found $x"
x=`expr $x + 1 `... (3 Replies)
Discussion started by: Benou
3 Replies
6. Shell Programming and Scripting
Hi,
I don't script often enough to know how to do this, and I can't seem to find a right example online. I have a csv output from an old, old system (Win2K???), from which I want to extract only certain fields. Initially I came up with something like this:
cat file1 | awk -F '"' '{print $8... (7 Replies)
Discussion started by: takada
7 Replies
7. Shell Programming and Scripting
Hi Experts,
I have a log file like this.I need to filter the Index name and elapsed time(only created ).
06:36:39 SQL> create index XYZ_F75 on XYZ
06:36:39 2 ("GRP_ID", "_ID") parallel 64 nologging
06:36:39 3 tablespace XARGS_IDX
06:36:39 4 ;
Index created.
Elapsed:... (2 Replies)
Discussion started by: navsan420
2 Replies
8. Shell Programming and Scripting
I am trying to grep a variable with multiple lines with multiple patterns
below is the pattern list in a variable called "grouplst", each pattern is speerated by "|"
grouplst="example1|example2|example3|example4|example5|example6|example7"
I need to use the patterns above to grep a... (2 Replies)
Discussion started by: ajetangay
2 Replies
9. Shell Programming and Scripting
Hello folks!
I got a list with about 880 lines. An example line looks like this:
attr1=sample,attr2=sample,attr3=sample,email=example@example.org;
EMAIL=example@example.org,attr3=sample,attr4=sample,attr5=sample,... (3 Replies)
Discussion started by: Chugger
3 Replies
10. Shell Programming and Scripting
I have a file similar to the below. I am selecting only the paragraphs with @inlineifset.
I am using the following command
sed '/@inlineifset/,/^ *$/!d;
s/@inlineifset{mrg, @btpar{@//' $flnm >> $ofln
This produces
@section Correlations between
seismograms,,,,}}
... (5 Replies)
Discussion started by: Danette
5 Replies
LEARN ABOUT OSX
pnmhistmap
pnmhistmap(1) General Commands Manual pnmhistmap(1)
NAME
pnmhistmap - draw a histogram for a PGM or PPM file
SYNOPSIS
pnmhistmap [-black] [-white] [-max N] [-verbose] [pnmfile]
DESCRIPTION
Reads a portable anymap as input, although bitmap (PBM) input produces an error message and no image. Produces an image showing a his-
togram of the color (or gray) values in the input. A graymap (PGM) input produces a bitmap output. A pixmap (PPM) input produces pixmap
output with three overlaid histograms: a red one for the red input, a green one for the green input, and a blue one for the blue input.
The output is fixed in size: 256 pixels wide by 200 pixels high.
OPTIONS
-black Ignores the count of black pixels when scaling the histogram.
-white Ignores the count of white pixels when scaling the histogram.
The -black and -white options, which can be used seperately or together, are useful for images with a large percentage of pixels whose
value is zero or 255, which can cause the remaining histogram data to become unreadbaly small. Note that, for pixmap inputs, these options
apply to all colors; if, for example, the input has a large number of bright-red areas, you will probably want to use the -white option.
-max N Force the scaling of the histogram to use N as the largest-count value. This is useful for inputs with a large percentage of sin-
gle-color pixels which are not black or white.
-verbose
Report the progress of making the histogram, including the largest-count value used to scale the output.
All flags can be abbreviated to their shortest unique prefix.
BUGS
Assumes maxval is always 255. Images with a smaller maxval will only use the lower-value side of the histogram. This can be overcome
either by piping the input through "pnmdepth 255" or by cutting and scaling the lower-value side of the histogram. Neither is a particu-
larly elegant solution.
Should allow the output size to be specified.
SEE ALSO
pgmhist(1), ppmhist(1), pgm(5), ppm(5)
AUTHOR
Wilson H. Bent. Jr. (whb@usc.edu).
25 October 1993 pnmhistmap(1)