469,293 Members | 1,585 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,293 developers. It's quick & easy.

csv file

The input for this script will be a .csv file which looks like the following.

"Pin Number","Pin Name","Direction"
"10","OTW#","O"
"4","OUTL+","O"
"5","OUTL+","O"
"6","OUTL+","O"
"1","OUTL-","O"
"2","OUTL-","O"
"3","OUTL-","O"
"8","TEST0","I"
"7","TEST1","I"

the output should look like the following

TEST0 =8 =L= =I=
TEST1 =7 =L= =I=
OUTL_PP =4 =R=OUTL+ =O=
OUTL_PP =5 =R=OUTL+ =O=
OUTL_PP =6 =R=OUTL+ =O=
OUTL_MM =1 =R=OUTL- =O=
OUTL_MM =2 =R=OUTL- =O=
OUTL_MM =3 =R=OUTL- =O=


Based on the direction all the inputs with letter "I" are grouped first then outputs "O" are grouped.

The " symbol is replaced as =
The , should be replaced as some blank space
The + sholud be replaced as PP
The - sholud be replaced as MM
Oct 9 '07 #1
2 1238
KevinADC
4,059 Expert 2GB
Nobody here is going to write your code for you. First you post the code you have been trying then someone will help. You have this question on another forum where a very generous and helpful person I know has replied to your question but you have not responded.
Oct 9 '07 #2
Nobody here is going to write your code for you. First you post the code you have been trying then someone will help. You have this question on another forum where a very generous and helpful person I know has replied to your question but you have not responded.
I have attached the code

Expand|Select|Wrap|Line Numbers
  1. $file = 'c:/test3.txt';        
  2. open(INFILE, $file);        
  3. @lines = <INFILE>;
  4. foreach (@lines) { 
  5.     my @values = split(/,/);
  6.  
Oct 9 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by matt | last post: by
7 posts views Thread by Joseph | last post: by
3 posts views Thread by StGo | last post: by
3 posts views Thread by Shapper | last post: by
reply views Thread by thjwong | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.