L
laura.hradowy
I and switching over to perl and need a starting point and need to write a
script that will do the following...
I just need a kick, and should be on my way.
I have a file that is separated by commas, if I print the file out I would
get this...
awk -F, '{print "204"$1","$2","$3}' FILE
The output is
204xxxx001,00 0 05 21,TELN NOT
204xxxx002,00 0 01 30,TELN NOT
204xxxx008,00 0 04 15,TELN NOT
204xxxx013,00 0 02 30,CUST HAS
204xxxx015,00 0 10 22,CUST HAS
I also need to insert data into this line...
204xxxx001,EAST_BLD,ROOM2,00 0 05 21
204xxxx002,EAST_BLD,ROOM2,00 0 01 30
I am just having a difficult time trying to take awk and convert to perl.
I know I can write in bash but I would like to try in perl.
How do I prompt user for input that will insert into the $2, as well as
$3.
Basically I want,
Enter BLD:
User enter is EAST_BLD
Enter room:
User enters in ROOM2
Then the perl script takes that info and inserts these fields into every
line, as well as adding 204 at the begining and dumping the last field.
And here is a trickier question...
How do I do a grep on CUST and then place those lines in a file
script that will do the following...
I just need a kick, and should be on my way.
I have a file that is separated by commas, if I print the file out I would
get this...
awk -F, '{print "204"$1","$2","$3}' FILE
The output is
204xxxx001,00 0 05 21,TELN NOT
204xxxx002,00 0 01 30,TELN NOT
204xxxx008,00 0 04 15,TELN NOT
204xxxx013,00 0 02 30,CUST HAS
204xxxx015,00 0 10 22,CUST HAS
I also need to insert data into this line...
204xxxx001,EAST_BLD,ROOM2,00 0 05 21
204xxxx002,EAST_BLD,ROOM2,00 0 01 30
I am just having a difficult time trying to take awk and convert to perl.
I know I can write in bash but I would like to try in perl.
How do I prompt user for input that will insert into the $2, as well as
$3.
Basically I want,
Enter BLD:
User enter is EAST_BLD
Enter room:
User enters in ROOM2
Then the perl script takes that info and inserts these fields into every
line, as well as adding 204 at the begining and dumping the last field.
And here is a trickier question...
How do I do a grep on CUST and then place those lines in a file