02-21-2006
Newbie problem with ksh script
Hi all,
I have a directory have all of the .stat and .dat file :
they are is a pipe separate flat file.
Example:
log-20061202.stat contain 1st line and last line of log-20061202.dat with record count of that day.
Example:
Total record = 240
Tom|02-12-2006|1600 W.Santa Clara|SanJose|95123|1001|ENG <--first
Mike|02-12-2006|23 Clayton Rd|San Francisco|94127|6666|PHY <-- last
log-20061202.dat have
NAME|DATETIME|Address|City|Zip|StudentID|Class
Tom|02-12-2006|1600 W.Santa Clara|SanJose|95123|1001|ENG <-- first
John|02-13-2006|234 Wlliam Rd|Oakland|94321|2324|MATH
..............................................
Mike|02-12-2006|23 Clayton Rd|San Francisco|94127|6666|PHY <--last
For each new log-yyyymmdd.dat file compare the record count from the stat file with the record count of the dat file. Raise an error if they do not match.
For each log-yyyymmdd.stat file have the first and last record of the dat file, confirm the first and last record of the dat file are in stat file. Raise an error if they do not match.
For each record that we are going to output file, the file to output is controled by the DATE field of the .dat file not the timestamp contained in the file name.
The output will have name yyyymmdd.dat and contain
NAME|STUDENTID|CLASS
This is a hard problem for me, please help me to learn more how to use ksh shell to solve it. Thanks for sharing.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a problem with the execution of a ksh as deamon on linux. I explain you first the context.
We have developped a Java program that execute every minutes an external (that we don't have developped) program with a config file in parameter.
The Java program is runned as deamon with a perl... (0 Replies)
Discussion started by: adrian.mihai
0 Replies
2. Shell Programming and Scripting
I trying to write a ksh script (without the help of the Kermit libraries) which connects to a ftp server and checks if the file "KEI.done" exists. If the file exists it print "files is there" if it doesnt exist it prints "file is not there". (the print statements will later be replaced with code to... (2 Replies)
Discussion started by: mike509123
2 Replies
3. Shell Programming and Scripting
If I have
start = 02282006;
end = 03152006;
How do I get
startdate = 02/28/2006;
enddate = 03/15/2006;
Thanks, (3 Replies)
Discussion started by: britney
3 Replies
4. Shell Programming and Scripting
Hi
I made a small script which uses ksh.
When i run the script then i get the following error
However when i run each of the commands on the commandline they get executed and provide the desired output. i cant figure out why the script is not running.
Kindly Help
Thanks in... (3 Replies)
Discussion started by: PradeepRed
3 Replies
5. Shell Programming and Scripting
Hello everybody...
I'm a Unix newbie and i just got this task at work to figure out what's wrong with a daily script my team is using.
The idea behind the script is that it takes the day before in a yyyymmdd format, find files with that date in a specific directory and executes an (irrelavant)... (4 Replies)
Discussion started by: adija
4 Replies
6. UNIX for Dummies Questions & Answers
I have a script "abc.sh" in /tmp which has exit 0 as its last line
when I run this script from /tmp/xyz/def.sh script as
. ../abc.sh
then the script executes but the control doesn't return to def.sh script for subsequent commands in def.sh
but if I invoke the abc.sh from inside the... (3 Replies)
Discussion started by: rakeshou
3 Replies
7. Shell Programming and Scripting
script is:
dirname= "$(date +%b%d)_$(date +%H%M)"
mkdir $dirname
should create a directory named Nov4_
Instead I get the following returned:
root@dchs-pint-001:/=>./test1
./test1: Nov04_0736: not found.
Usage: mkdir Directory ...
root@dchs-pint-001:/=>
TOO easy, but what am I... (2 Replies)
Discussion started by: gwfay
2 Replies
8. Shell Programming and Scripting
my default profile is using ksh, I tried to write a simple scripts and I had issues, below is my scripts:
$ more if_num.ksh
USAGE="usage: if_num.ksh"
print -n "Enter two numbers: "
read x y
if ((x=y))
then
print "You entered the same number twice."
when I tried to executed the... (6 Replies)
Discussion started by: matthew00
6 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I am in ksh.
below mentioned 3 commands I executed at command prompt & got the expected results.
csh
source csh_infa
<special command>
Now I have to do this in the script in ksh. I entered it as it is.
#!/bin/ksh
csh
source csh_infa
<special command>
Now after... (1 Reply)
Discussion started by: girish_kanak
1 Replies
10. Shell Programming and Scripting
Hello,
Ubuntu server 11.10
can anybody help what is problem with my shell script?
#!/bin/bash
#script to find out currently logged on user is root or not.
if ]
then
echo "You are super"
else
echo "You are awesome!"
fi
When I run script, I get following output
./uid: line 3:
I... (4 Replies)
Discussion started by: kaustubh
4 Replies
LEARN ABOUT DEBIAN
plotit
plotit(1) General Commands Manual plotit(1)
NAME
plotit - experiment data visualization
SYNOPSIS
plotit -w FILE
plotit [-lp] -q FILE [FILE]...
plotit [-lp] Y FILE [FILE...]
plotit [-lp] X Y FILE [FILE...]
DESCRIPTION
The plotit program is a simple plotting program which can draw line plots and stripcharts using a command language similar to that of gnu-
plot. It can also make quick plots of multiple data files from the command-line. Wildcards may be used in the file names.
The program takes optional expressions which can be used to manipulate data columns before plotting. Expressions may be as simple as the
designation of a column to be plotted or may contain arithmetic expressions and functions. In the latter case the espression must be
enclosed in 'single' or "double" quotation marks. Column numbers are designated by the at-sign character (@). A single expression is used
for the Y axis of the plot.
OPTIONS
-h, --help
Print the usage and exit.
--version
Print the version number and exit.
-w Watch the input file for commands to stripchart, or wait to read all of stdin before plotting. Only one file or - for stdin may be
specified with this option. No other options may be used in conjuction with this option.
-q Plot the first and second columns of each file.
-l Plot with lines.
-p Plot with points.
EXAMPLES
Plot the second column versus the first of all three files with lines only.
plotit -lq file1.dat file2.dat file3.dat
Plot the quotient of the third column and the second column versus the first column of all files matching the pattern using points only.
plotit -p '@3/@2' file??.dat
Plot the natural log of the second column divided by the third column versus the fourth column. By default these data are plotted with
both lines and points.
plotit @4 'log(@2/@3)' file.dat
AUTHOR
This manual page was written by Carlo Segre <segre@iit.edu>.
February 21, 2009 plotit(1)