based on the logic i will another script which might have similar..as of now the request is not yet received.....
1. at home i have got bash...in office it is ksh..but it has be ksh complaint since
i will writing it in ksh later one.
OK. The following ksh script will also work with bash.
Quote:
2.missed out pointing if there is tie we need to report those as well....
OK. The following ksh/awk script will report ties.
Quote:
3.the files which i created are used for my calculation to get the end result.....we need to delete them as the script as finished....need to add rm statement at the end of the script.
OK. The following script just doesn't create those files.
Quote:
4.The code which you are referring will create a text file with all the unique item so that we can add similar item in those files and get the result....
It doesn't create any files that won't be created by later steps in your code. And, more importantly, if files already exist with those names, it won't discard data created in earlier runs. The touch commands in that loop don't do anything but set the timestamps on those files to the current time if the files exist, or create them if they don't already exist. This loop does not put any data in any of those files.
Quote:
note : we might have some other data for which we might have to use specific grep pattern....but since this is sample date or similar data that i will have deal with hence i m preparing for it...
My crystal ball isn't good enough to guess at what you might want to do but haven't specified. The following code does produce some output you said you wanted that I don't see being produced by your script.
Quote:
Hope it helps.
Maybe this script:
which, with your sample data produces the output:
(but the order of the output of items in each section of the output may vary with different version of awk) will give you an idea of how to report similar results for other questions that might arise from your data.
This will work as is on both Red Hat and AIX. If someone wants to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk.
Note that it only reads your data file once and produces no temporary files. The awk code used in this script is pretty straight forward. If you don't understand how it works (after looking at the awk man page), feel free to ask questions.
Thank you very much for the script, it is working as it should be.
Since my knowledge on awk is minimal, i was not able to understand the script...could you please explain the script in your free time for our benefit.
cheers...
regards,
bhupesh
Hi bhupesh,
Did you look at the awk man page on your system? (i.e., run the command man awk?)
I would be happy to try to explain any part of that script that you are having trouble understanding. What part(s) of the script were you not able to understand?
Hi,
I am beginner in shell scripting. I have written a script to parse file(s) having large number of lines each having multiple comma separated strings.
But it seems like script is very slow. It took more than 30mins to parse a file with size 120MB (523564 lines), below is the script code
... (4 Replies)
Below is my script. However when i run it, i get the below error
./dummy.sh: line 27: syntax error: unexpected end of file
#!/bin/bash
while :
do
read -r INPUT_STRING
case $INPUT_STRING in
test)
echo "Please enter id no : "
read... (4 Replies)
Hi,
I have a file at $HOME/t.txt, below is file content
cat $HOME/t.txt
CUSTOMER_${REGION}.out
Am using this file content in one script $HOME/samp.sh, below is the script
#!/bin/bash
REGION=USA
x=`cat ${HOME}/t.txt`
echo $x
Am getting following output.. CUSTOMER_${REGION}.out
... (3 Replies)
I found a post from a user requesting help rounding numbers. The script provided by Scrutinizer works fine most of the time but it errors out when trying to round these numbers:
30224939
50872456
20753012
They have in common, a zero in the second digit from left to right. Can someone help... (1 Reply)
I have a script in TC shell, for some reason its not working.
I'm trying to kick off a script if there are any files in a particular directory "/sample/test3"
Can anyone point out the issue in the same
#!/usr/bin/tcsh
while true
do
if ls /sample/test3 >& /dev/null ; then... (2 Replies)
Hi Folks,
I am looking for a script where that should show the progress bar while running a process
Ex: while copying a file of size say 2 GB it should start the process as (0 %) and at the end it should show (100%)
Thanks in Advance
Phani. (4 Replies)
hi , this script was devloped by somebody whome I dont know way back
# cat run_ucid.sh
#!/bin/csh
# run_ucid.sh
#
# This is a simple shell script that will start an application in
# the background and restart the application if it stops. Upon
# termination an email message is sent and the... (2 Replies)
Hi,
I created the following shell script file :
bash-3.00$ more Unlock_Statistics1.sh
#!/usr/bin/ksh
ORACLE_SID=prsal02; export ORACLE_SID
NLS_LANG=AMERICAN_AMERICA.AL32UTF8; export NLS_LANG
sqlplus -s /nolog << EOF
connect / as sysdba ;
set serveroutput on size 1000000;
execute... (1 Reply)
Hi All,
I have an issue in writing the shell script to install a webserver on UNIX system. My shell script look something like this.
------------------------------------------------------------
echo "start of the script"
#! /bin/sh
cd /home/path
echo | setup.hp -is:javaconsole -console... (4 Replies)