i had the data in the following form:
Branch : 3379 As On : 31-JAN-2009 Page : 1
User Id : OPER1 Date & Time : 01-FEB-2009 04:02:37
------------------------------------------------------------------------------------------------------------------------------------
Period JAN LCY Amount FCY Amount (LCY Eq) Total
with Branch:3379 and As on : 31-jan-2009 at the top of the report......
The report contained 5 columns.......
what i want is to have 7 columns of only data (without header and footer)....first column should be the Branch code ie., 3379; second
column should be the date of the report ie., 31-jan-2009 and rest of the
data in the order of 1,2,3,4, and 5th columns in the place of 3,4,5,6, and 7th columns......
Example:
3379 31-jan-2009 220120100 BALANCE IN C/A-WITH SBI 18,375.58 0.00 18,375.58
i had the data in the following form:
Branch : 3379 As On : 31-JAN-2009 Page : 1
User Id : OPER1 Date & Time : 01-FEB-2009 04:02:37
------------------------------------------------------------------------------------------------------------------------------------
Period JAN LCY Amount FCY Amount (LCY Eq) Total
with Branch:3379 and As on : 31-jan-2009 at the top of the report......
The report contained 5 columns.......
what i want is to have 7 columns of only data (without header and footer)....first column should be the Branch code ie., 3379; second
column should be the date of the report ie., 31-jan-2009 and rest of the
data in the order of 1,2,3,4, and 5th columns in the place of 3,4,5,6, and 7th columns......
Example:
3379 31-jan-2009 220120100 BALANCE IN C/A-WITH SBI 18,375.58 0.00 18,375.58
i tried the following to get the data under the following heads
branch date code total
3379 31012009 220120100 18,375.58
3379 31012009 220720200 0.00
3379 31012009 220720400 69,564.99
3379 31012009 220720600 77,843.76
i could not succeed, the change of character position did not result in
any data...
---------- Post updated at 06:44 PM ---------- Previous update was at 06:17 PM ----------
Quote:
Originally Posted by gaurav1086
Plz tell what have you tried so far..
sir.. thank u for calling
i tried the following to get the data under the following heads
branch date code total
3379 31012009 220120100 18,375.58
3379 31012009 220720200 0.00
3379 31012009 220720400 69,564.99
3379 31012009 220720600 77,843.76
i could not succeed, the change of character position did not result in
any data...
Code:
{a=b=0a=index($0,"Branch : ")b=index($0,"As On : ")if ( a > 0 ) { bic=substr($0,length($0)11,4) next }if ( b > 0 ) { split(substr($0,63,11),datee,"-") if ( datee[2]=="jan") { mm=01 } if ( datee[2]=="feb") { mm=02 } if ( datee[2]=="mar") { mm=03 } if ( datee[2]=="apr") { mm=04 } if ( datee[2]=="may") { mm=05 } if ( datee[2]=="jun") { mm=06 } if ( datee[2]=="jul") { mm=07 } if ( datee[2]=="aug") { mm=08 } if ( datee[2]=="sep") { mm=09 } if ( datee[2]=="oct") { mm=10 } if ( datee[2]=="nov") { mm=11 } if ( datee[2]=="dec") { mm=12 } date1=sprintf("%02d%02d%04d",datee[1],mm,datee[3]) next }ctr=split($0,arr," ")amt=kod=0if (ctr > 1) { for (i=1;i<(ctr+1);i++) { if (index(arr[i],".") > 0 ) { gsub(",","",arr[i]) gsub("\\.","",arr[i]) gsub("-","",arr[i]) } } for (i=1;i<ctr;i++) { if ( (arr[i] ~ /^[0-9]+$/) && ( arr[i+1] ~ /^[0-9]+$/)) { kod=arr[i]+0 amt=arr[i+1]+0 i++ } } if ( kod > 100000000 && kod < 999999999 && amt > 0 ) { printf("%04d%08d%09d%013.0f\n",bic,date1,kod,amt*1) kod=amt=0 } }}
Last edited by Scott; 12-19-2009 at 08:53 AM..
Reason: Please use code tags
Hello Gurus,
I am trying to fetch a required number of lines from an output of a command which is in tabular form.
Below is the command for reference along with how the result is being shown on UNIX shell.
/usr/openv/volmgr/bin/vmquery -b -p 5
The result of the above command is as... (6 Replies)
I have a text file with contents like this:
a,b,c,
d~e,f,g,h~i,j
,k,l,m~n,o,p,q~
I need to convert this file into this format unix shell script commands:
a,b,c,d~
e,f,g,h~
i,j,k,l,m~
n,o,p,q~
as you may have noticed, I need to retain the ~ signs at the end.
Any help is greatly... (3 Replies)
Hi,
I have a csv file from which i am fetching few columns as below:
IFILE=/home/home1/Report1.csv
OFILE=/home/home1/`date +"%m%d%y%H%M%S"`.dat
if #Checks if file exists and readable
then
awk -F "," '(NR>4) {print $1,$6,$2,$3,$4,$5,$6}' ${IFILE} >> ${OFILE}
fi
cat $OFILE | mail... (7 Replies)
Dear Friends,
I have a file as under :
+++ ME 12-06-13 18:16:20
A RED FEW AND ROW1 1MN FEL AS
HI FI BV LR TS HR ES MR
* 0 13296 0 120 1 15
KS RR
10 0
+++ ME 12-06-13 18:26:20
A RED FEW AND ROW2 1MN FEL AS... (2 Replies)
Hi,
Some assistance with respect to the following problem will be very helpful.
I want to reformat my dataset in the following manner for subsequent analysis.
I have first column values (which repeat for each value of 2nd column) which are names, the second column specifies position ad the... (1 Reply)
Hello all.
I have an incredible number of servers that I need to change a parameter on using a web interface. I'd like to be able to do this via curl, but I'm having some trouble. I filled out the form and hit update while snooping (tcpdump) my interface. That gave the the following as what is... (0 Replies)
I would like to convert one form of xml tag data to another
<DescriptionList>
<DescriptionExt language="en" shortDesc="ITALIAN SAUSAGE SUB" longDesc="" sizeDesc="" smallImage="Pictures\sub-italian-sausage.png" largeImage="" forceImageUpdate="yes" />
... (1 Reply)
Hi,
I have a file whose structure is like this
7
7
1 2 3 4 5
1 3 4 8 6
1 4 5 6 0
2 6 8 3 8
2 5 7 8 0
5 7 9 4 1
3 8 0 2 2
3 5 6 8
basically first two row tell the number of rows and column but the data following them are not arranged in that format. now i want to create another... (1 Reply)
I am user Of linux 9.0 Operating System and I had data form unix Operating system and I am not abel to open it in linux 9.0 Please tell me how can i use unix data in linux . (3 Replies)