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,
 
NCURSES_COLOR_CONTENT(3)						 1						  NCURSES_COLOR_CONTENT(3)

ncurses_color_content - Retrieves RGB components of a color

SYNOPSIS
int ncurses_color_content (int $color, int &$r, int &$g, int &$b) DESCRIPTION
Retrieves the red, green, and blue components for the given color definition. Terminal color capabilities must be initialized with ncurses_start_color(3) prior to calling this function. PARAMETERS
o $color - The number of the color to retrieve information for. May be one of the pre-defined color constants. o $r - A reference to which to return the red component of the color. The value returned to the reference will be between 0 and 1000. o $g - A reference to which to return the green component of the color. The value returned to the reference will be between 0 and 1000. o $b - A reference to which to return the blue component of the color. The value returned to the reference will be between 0 and 1000. RETURN VALUES
Returns -1 if the function was successful, and 0 if ncurses or terminal color capabilities have not been initialized. SEE ALSO
ncurses_init_color(3), ncurses_start_color(3). PHP Documentation Group NCURSES_COLOR_CONTENT(3)
All times are GMT -4. The time now is 03:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy