Sponsored Content
Full Discussion: If not ...then
Top Forums Shell Programming and Scripting If not ...then Post 99087 by sabercats on Tuesday 14th of February 2006 02:26:50 PM
Old 02-14-2006
I can not use sed in this case because sed look for a file, but I look for a field.

here is my code:
========

#!/bin/ksh
cd /DATA
for file in MainCD*log; do
newFile=`ls -1 $file|awk -F. '{ \
y = substr($1,7,4); \
m = substr($1,11,2); \
d = substr($1,13,2); \
printf "irv-%s%s%s.dat",y,m,d \
}'`
grep "," $file |
sort -t"|" +1 -2 +5 -6 |
awk -F"," '{

if (($5 == "002") && ($6 == "FE")) {
ani = $7;
logdate = $3;
logtime = $4;

lastloc = $10;
acc = $9;

if ($19 !~ /^FE|^MN/)

sub(/^:/,"",firstloc)

printf "%s|%s|%s|%s|%s|%s\n",ani,logdate,logtime,firstloc,lastloc,acc;

}

}' |
sort -t, +0 -1 > /NEWDIRECT/$newFile


done

============

I really want the firstloc have only
firstloc=SV-SvcMenu

or

firstloc= BP-FinStatus

Please show me what trick you will use Smilie
Thanks,
 
ppmhist(1)						      General Commands Manual							ppmhist(1)

NAME
ppmhist - print a histogram of a portable pixmap SYNOPSIS
ppmhist [-hexcolor] [-noheader] [-map] [-nomap] [-sort={frequency,rgb}] [ppmfile] DESCRIPTION
Reads a PPM image as input. Generates a histogram of the colors in the image, i.e. a list of all the colors and how many pixels of each color are in the image. OPTIONS
-sort={frequency,rgb} The -sort option determines the order in which the colors are listed in the output. frequency means to list them in order of how pixels in the input image have the color, with the most represented colors first. rgb means to sort them first by the intensity of the red component of the color, the of the green, then of the blue, with the least intense first. The default is frequency. -hexcolor Print the color components in hexadecimal. Default is decimal. -noheader Do not print the column headings. -map Generates a PPM file of the colormap for the image, with the color histogram as comments. -nomap Generates the histogram for human reading. This is the default. SEE ALSO
ppm(5), pgmhist(1), ppmtomap(1), pnmhistmap(1), ppmchange(1) AUTHOR
Copyright (C) 1989 by Jef Poskanzer. 17 September 2000 ppmhist(1)
All times are GMT -4. The time now is 03:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy