You'll have to provide more data from the actual file.
--ahamed
Sorry for the late reply....
It will have only till A,B,C .... it wn't increase to D,E.... but
some time any one or two might not be their ... those cases has to be left as empty.
---------- Post updated at 09:23 AM ---------- Previous update was at 09:23 AM ----------
Quote:
Originally Posted by yazu
And is it important to have columns A, B, C in the order or it may be in an arbitrary order, like B, C, A, D (with the right following rows, of course)?
i need to export that to excel .. so that should be in order as A,B,C
---------- Post updated at 09:36 AM ---------- Previous update was at 09:23 AM ----------
Quote:
Originally Posted by MSMario
Here it is
Code:
for i in `cat tekst | grep value | awk '{print $4 "=" $5}'`
do
x=`echo $i | cut -d "=" -f 1`
y=`echo $i | cut -d "=" -f 2`
if [ $x == "A" ]; then
t=$[t+1];
a=$y;
elif [ $x == "B" ]; then
t=$[t+3];
b=$y;
elif [ $x == "C" ]; then
t=$[t+5];
c=$y;
if [ $t -eq 9 ]; then
echo $a,$b,$c
elif [ $t -eq 1 ]; then
echo $a, ,
elif [ $t -eq 6 ]; then
echo $a, ,$c
elif [ $t -eq 8 ]; then
echo ' ',$b,$c
fi
t=0;
fi
done
with viariable t you have to make all possibilites with missing one ore two
script is giving a error in
Code:
if [ $x == "A" ]; then
t=$[t+1];
a=$y;
elif [ $x == "B" ]; then
t=$[t+3];
b=$y;
elif [ $x == "C" ]; then
Below is the error i am getting
Code:
./test2.ksh[5]: ==: A test command parameter is not valid.
./test2.ksh[8]: ==: A test command parameter is not valid.
./test2.ksh[11]: ==: A test command parameter is not valid.
---------- Post updated at 09:55 AM ---------- Previous update was at 09:36 AM ----------
I tried with 'Sed' but i couldn't able to find proper command...
Help with the simple and command options
Hi all,
I need a logic in UNIX to append contents of a file in same row, where the original contents are found one below the other. For example.
My i/p file contains:
“user1”,”employee1”,”04/28/2009”
“5678”
“78”
“user2”,”employee2”,”04/30/2009”
I want my output... (8 Replies)
This is the code:
while test 1 -eq 1
do
read a
$a
if test $a = stop
then
break
fi
done
I read a command on every loop an execute it.
I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test.
For example echo hello.
Now the... (1 Reply)
Hi
I want to append line 2n to 2n-1 line where n=1...LastLine in my file.
eg:
Actual File:
Hello
Everyone
Welcome
TO Unix
I need
Your help
Required File:
HelloEveryone
WelcomeTO Unix
I needYour help (5 Replies)
Hi All
I will run the same script every day in corn and output should go to same CSV file but in different row with dates on it. Below is my example in attached format.
Script i am using to collect switch port online
DATE=`date '+%d-%m-%y'`
for f in `cat... (1 Reply)
Hi! Is there a way to append column and row header to a file in awk script.
For example if I have
Jane F 39 manager
Carlos M 40 system administrator
Sam F 20 programmer
and I want it to be
# name gend age occup
1 Jane F 39 manager
2 Carlos M ... (4 Replies)
I have a script that is inventorying (not sure if thats a word) my environment.
It goes out and pulls Hostname OS, IP, and ENV (dev, prod, etc)..then spits all that to a logfile
At the top of my script i have a check to see if the logfile exist.
] || touch $LOGFILE && echo "ENV" "\t"... (3 Replies)
Hi ALL,
We have requirement in a file, i have multiple rows.
Example below:
Input file rows
01,1,102319,0,0,70,26,U,1,331,000000113200000011920000001212
01,1,102319,0,1,80,20,U,1,241,00000059420000006021
I need my output file should be as mentioned below. Last field should split for... (4 Replies)